Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lightbox: Offer to open browser if video player doesn't support a video format #1208

Open
chrisbobbe opened this issue Dec 26, 2024 · 1 comment
Labels
a-lightbox The lightbox / image-viewer screen beta feedback Things beta users have specifically asked for
Milestone

Comments

@chrisbobbe
Copy link
Collaborator

Sometimes the video player fails to initialize because the video format isn't supported:

image

The app relies on the platform's (iOS or Android) set of implementations for playing videos of various formats. Sometimes the platform doesn't support a video but the user's browser does because the browser brings its own implementation. For example, it fails in the app for me on iOS 18.1.1 but succeeds in Chrome on the same device. See discussion in beta feedback.

So, when a video is unsupported, it would be helpful to offer to open it in the browser.


Implementation notes:

Here's the note from the library we use, video_player:

https://github.com/flutter/packages/tree/311b660c6/packages/video_player/video_player

Supported Formats

  • On iOS and macOS, the backing player is AVPlayer.
    The supported formats vary depending on the version of iOS, AVURLAsset class
    has audiovisualTypes that you can query for supported av formats.
  • On Android, the backing player is ExoPlayer,
    please refer here for list of supported formats.

[…]

The error I get on iOS is a PlatformException; here's what went by in the logs:

flutter: VideoPlayerController.networkUrl(https://chat.zulip.org/user_uploads/2/86/dBbfIDB3gWLscD3dQXnsBlXc/Screencast-from-2024-12-26-00-48-11.webm)
flutter: VideoPlayerController.initialize failed: PlatformException(VideoError, Failed to load video: Cannot Open: This media format is not supported.: The operation couldn’t be completed. (OSStatus error -12847.), null, null)

Looks like the structured "code" part is just a generic "VideoError", and the part that says it's specifically a format issue is this string:

Failed to load video: Cannot Open: This media format is not supported.: The operation couldn’t be completed. (OSStatus error -12847.)

Rather than parsing that, let's try just assuming a "VideoError"—or perhaps any error—is a good reason to offer to open the browser, and do so.

If the video is on-realm, needing authentication, we should use the "temp file URL" protocol; see api.tryGetFileTemporaryUrl in zulip-mobile.

@chrisbobbe chrisbobbe added the a-lightbox The lightbox / image-viewer screen label Dec 26, 2024
@chrisbobbe chrisbobbe added the beta feedback Things beta users have specifically asked for label Dec 26, 2024
@chrisbobbe chrisbobbe added this to the M7: Future milestone Dec 26, 2024
@chrisbobbe
Copy link
Collaborator Author

chrisbobbe commented Dec 26, 2024

zulip-mobile lacks an in-app video player and just always opens videos in the browser. This is usually a worse experience (the change of context could be annoying), but ends up being better in this uncommon case (where the platform doesn't support the video but the browser does).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a-lightbox The lightbox / image-viewer screen beta feedback Things beta users have specifically asked for
Projects
Status: No status
Development

No branches or pull requests

1 participant