-
Notifications
You must be signed in to change notification settings - Fork 33
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
Video playback stops when locking the device #66
Comments
Works fine with iOS 12.2, not anymore with iOS 12.3.1. The change probably was made in iOS 12.3. |
What changed in iOS 12.3 is how the system handles the player state when bound to a player layer:
As mentioned above, the correct way to have video playback continue in background is to detach the player layer in background. Note that background includes lock screen playback as well (this is considered background, but was treated differently in earlier iOS versions from an I initially intended to provide an API with the following modes:
This API is tightly bound to the iOS behavior, though, and would lead to different implementations based on iOS versions. The system behavior might change in the future as well. To avoid such issues and provide for a more consistent behavior, I finally decided to provide an API with the following modes:
No strong guarantees are made about those modes (as the result might vary between iOS versions depending on what the system enforces), but the general rule is to detach layers to maximize the chances for background playback. Note that audio playback is never affected and works in background. Using this new API, we therefore have:
|
Available for review on the |
What remains to be done:
|
Answers:
|
Testing is a bit cumbersome and can only be manual. The main idea can be summarised as follows: If a view is attached to the player and installed in the view hierarchy, playback will continue or be paused depending on the I updated the inline demo so that playing with all kinds of different setups is easy. Just build the demo and check that the following expected behaviours are fulfilled when playing a video. Here is the expected result for all possible settings:
|
Probably starting with a recent iOS 12 version (yet to be determined), playback stops when on the lock screen, which was not enforced by SRG Media Player.
We should detach the video layer to achieve proper behavior again. Disabling visual tracks does not work for streamed medias and is therefore not a good strategy.
The text was updated successfully, but these errors were encountered: