You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the application is sent to the background while the player is still preparing (can be simulated with the network link conditioner), the completion handler will be called when the player is ready, at which point a call to -play from this handler might start playback in background.
While this is perfectly acceptable for audio or for video background playback if allowed, this should not occur if background behavior detaches the view (in which case we should probably pause the playback to simulate the associated effect).
I naively see two possible fixes:
We can avoid calling the completion handler in this case. I don't like this approach, as this would also impact playback being prepared into the paused state (i.e. without call to -play from the handler).
Call -pause on AVPlayerafter the completion handler has been called, if SRGMediaPlayerViewBackgroundBehaviorAttached and we know that the loaded content is a video. This seems better to me. We probably have to also check AirPlay status or other settings which might affect this behavior.
The text was updated successfully, but these errors were encountered:
It's funnier than expected: The player item never reaches AVPlayerItemStatusReadyToPlay (video and audio) if the app is sent to the background while preparing to play. Once the application is resumed this status is reached immediately, and playback starts.
The issue was first reported with our Letterbox player, but I thought the culprit was Media Player. It does not seem so. I have opened a similar issue for Letterbox and closed this one.
If the application is sent to the background while the player is still preparing (can be simulated with the network link conditioner), the completion handler will be called when the player is ready, at which point a call to
-play
from this handler might start playback in background.While this is perfectly acceptable for audio or for video background playback if allowed, this should not occur if background behavior detaches the view (in which case we should probably pause the playback to simulate the associated effect).
I naively see two possible fixes:
-play
from the handler).-pause
onAVPlayer
after the completion handler has been called, ifSRGMediaPlayerViewBackgroundBehaviorAttached
and we know that the loaded content is a video. This seems better to me. We probably have to also check AirPlay status or other settings which might affect this behavior.The text was updated successfully, but these errors were encountered: