Skip to content

[video_player] - An error that occurs in the video player on the platform after it's been initialized and rendered causes the video to disappear #68914

@dannyvalentesonos

Description

@dannyvalentesonos

Once the video has initialized and at least one frame has been rendered, if any subsequent error occurs on the platform, the video will disappear.

This is because of this code in video_player.dart

void errorListener(Object obj) {
      final PlatformException e = obj;
      value = VideoPlayerValue.erroneous(e.message);
      _timer?.cancel();
      if (!initializingCompleter.isCompleted) {
        initializingCompleter.completeError(obj);
      }
    }

This code ends up replacing the value with one that has a null'd size property, and that causes the VideoPlayer to not be able to render it when surrounding it by an AspectRatio widget, or something similar, which needs the size to be able to lay it out.

Once the video has been initialized, any errors afterwards should not cause the video to become impossible to render. It would be best to let the consumer know the video has an error, but the last frame should remain on screen.

This has become more prominent with the potential errors that can be returned as a result of flutter/plugins#3084.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listfound in release: 1.22Found to occur in 1.22has reproducible stepsThe issue has been confirmed reproducible and is ready to work onp: video_playerThe Video Player pluginpackageflutter/packages repository. See also p: labels.r: timeoutIssue is closed due to author not providing the requested details in timewaiting for customer responseThe Flutter team cannot make further progress on this issue until the original reporter responds

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions