Native Video Player #324
Replies: 2 comments
-
What I found useful when updating the video player in our app is to also turn on canStartPictureInPictureAutomaticallyFromInline and observe didBecomeActiveNotification where we call stopPictureInPicture to get back the regular video player instead of continuing PiP. Apple forgot to add this method to the public API (it is public for AVPictureInPictureController but not for AVPlayerViewController), so we have to use respondsToSelector/performSelector but I haven't heard of any app that got rejected for using it. |
Beta Was this translation helpful? Give feedback.
-
Closing as the device profile and URL construction systems have been entirely refactored and custom device profiles are now implemented. Native player metadata is currently in progress in #1203 atow. |
Beta Was this translation helpful? Give feedback.
-
The native video player is currently experimental and has many issues, implemented here. At time of writing, its implementation is not a focus of development as other advances must be made in the app. This serves as developer notes that I have run into while implementing the initial native video player for other developers that want to take a look at it.
1 - Device Profile Builder
The device profile builder must have special conditions for the native video player codecs support. The device profile builder needs to be fixed at time of writing and is tracked here but native video player codec support is not a requirement.
2 - HLS Stream Construction
The web interface constructs the HLS stream with a variety of factors tailored to the media. I am not familiar with this construction and just implemented a few parameters that are necessary for the stream to play. Take a look at the jellyfin-web project to figure this out.
3 - Picture in Picture
PiP support is more than just than enabling it, it must have special handlers to handle PiP actions like pausing and closing PiP which need calls to send the progress reports and pause/unpause reports. Views must also be created or modified to also accommodate the state of being in PiP. For simplicity, we will not allow people to enter PiP and then navigation throughout Swiftfin. Do not worry about PiP on tvOS.Update: PiP implemented on iOS in #786. Since there was no longer an issue of the video player popping and progress reports also send as expected, tvOS may get it.
4 - tvOS Metadata
The tvOS player allows a lot of metadata to be supplied to improve the experience. However not all of the necessary metadata is always provided (like a backdrop image) and can crash the application. Chapter support was also attempted but the correct ranges of the chapters must be calculated, this is also done in
VideoPlayerViewController
so you can use that as reference.5 - Other
make sure to accommodate transcoded streamsthe current timer that send progress reports should be improvedBeta Was this translation helpful? Give feedback.
All reactions