-
Notifications
You must be signed in to change notification settings - Fork 7
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
Continuous playback does not work in background #211
Comments
I investigated this issue. When playback ends, the app is suspended since there is no active audio anymore. This is why the continuous timer does not fire until the app is woken up again. I tried using the background processing capability and the associated API to ask for some more time. The notification is fired correctly, but playback does not start and remains paused in background. Actually, when Using |
Rewriting SRG Media Player to support item enqueuing with a single controller would be a huge task. This would require us to store the media to be played with its context (initial position, segments, etc.), but also to add dedicated APIs to mange the queue itself (e.g. cancel playback of the current item and all remaining ones). I verified that the issue we have with continuous playback is due to the fact that we are recreating an If we use an Note that using I therefore recommend the following strategy to ensure
Of course, this means we don't use |
As noted by @pyby, the above approach assumes we readily have the URL at the end of the first media. But with Letterbox, and if the controller does not fetch the next media in advance, the URL is not known directly, and can take some time to be retrieved with a network request. Using |
A rough draft of what we could make:
Anyway, this is no small task (and the above idea might probably need some thoughts). |
Of course chaining should not break PiP or AirPlay playback if active. |
Our SRF fellow colleagues found a workaround by registering a dummy remote control center command enabled at all times. Seems the command must not be the first registered, so the code should be inserted somewhere after the first play command has been registered (in the current codebase). We should:
If the trick works on all iOS versions and the last answer is negative we can then deliver this workaround officially in Letterbox, but likely as an opt-in. It is namely likely that if the app does some kind of periodic work in the background (which Letterbox demo doesn't), the fact it is kept alive will make this work continue while the app seems to be dormant, possibly leading to battery drain (e.g. if network interfaces are woken up periodically, especially on mobile networks). Note that since Xcode 13 / iOS 15 the energy log tool is not available anymore. This makes it more complicated to evaluate the energy impact of the workaround. |
Workaround works on iOS 16 beta 3. |
This issue is fixed in Letterbox successor Pillarbox. I will keep it open as it was one of the major reasons why Pillarbox exists in the first place, but Letterbox itself will never be able to fix this behavior as this requires the whole implementation to be built on |
In background, continuous playback does not chain medias automatically. This is probably due to the fact that timers are paused in background and do not fire, and probably is a consequence of the changes made to reduce player activity in background.
Issue type
Incorrect behavior
Environment information
Reproducibility
Always reproducible
Steps to reproduce
The text was updated successfully, but these errors were encountered: