RenderHeads / UnityPlugin-AVProVideo

AVPro Video is a multi-platform Unity plugin for advanced video playback
https://www.renderheads.com/products/avpro-video/
224 stars 27 forks source link

Fullscreen and PIP video playback on mobile #1850

Open roger-o3h opened 1 month ago

roger-o3h commented 1 month ago

Is your feature request related to a problem? Please describe. To have feature parity with native apps and websites, users expect to be able to do the following on video players in an app:

  1. Hit a button to present them in exclusive fullscreen (Android, iOS, tvOS)
  2. Either through user interaction, or when backgrounding the app with video playing, have the video continue playing in a floating PIP (iOS)
  3. Allow system-level "casting" of video, e.g. Airplay on iOS

Describe the solution you'd like

  1. A method on the MediaPlayer class that seamlessly (without pausing playback) displays the video in an exclusive fullscreen mode, with native controls including the native button to exit fullscreen, and native casting options
  2. Properties on the MediaPlayer instance which reflect functionality in AVPlayerViewController including allowsPictureInPicturePlayback, canStartPictureInPictureAutomaticallyFromInline, entersFullScreenWhenPlaybackBegins, exitsFullScreenWhenPlaybackEnds

Describe alternatives you've considered

  1. Transitioning the player to an in-Unity view that covers the entire screen. This is fine, but without perfect mimicry, it's obvious that it's not the native experience which users expect.
  2. Can't think of an easy alternative to backgrounded PIP.

Additional context It's likely that AVPro is using AVFoundation at a much lower level that wouldn't permit use of the AVPlayerViewController. But if this is the only way to get into it, what if there was a Display type that used the native player in iOS, tracked to the screen space rect of its proxy in Unity. It would have a number of drawbacks regarding layering, but the tradeoff is that it would support the native video features that users have come to expect in recent os revisions.