playsrg-apple
playsrg-apple copied to clipboard
Playback incorrectly jumps when playing parent of segment already being played
When already playing a segment, tapping on its full-length elsewhere in the app restarts it at the beginning. This should not be the case (the content is namely the same).
Issue type
Incorrect behavior
Environment information
- Application version: Any, but tested with 3.0.0
- iOS version: Any
- Device: Any
Reproducibility
Always reproducible
Code sample
Steps to reproduce
- Enable background video playback (segments are for on-demand content mostly).
- Play a 19h30 segment, either directly or as part of normal playback (no active selection required).
- Close the player. Playback continues in the background.
- Now find this 19h30 item elsewhere in the app and tap on it. Instead of just reopening the player, playback restarts at the beginning.
Note that this issue is a bit more visible with 3.1.0 and program segments: Because you don't need background video playback to be enabled (this is audio after all), playing a livestream and tapping on the same item on the live tab will move the playback position to the live edge.
This issue follows from current Letterbox behaviour as well as Play implementation. We should improve both:
Letterbox
Currently, playing the same content as already being played is a no-op. We should adopt a behaviour to watch the -switch
method does, more precisely:
- If playing the same media or URN as already being played:
- If a position has been provided, seek to it.
- If the default position is used (
nil
), do not do anything.
- If playing the parent media or URN of the media already being played:
- If a position has been provided, seek to it.
- If the default position is used (
nil
), do not do anything.
- If playing a sibling media or URN as the media already being played, switch.
Maybe the last two cases can be reduced to a simple -switch
method call
Play
In Play, we should simplify our MediaPlayerViewController
API by removing creation for a URN or media, only retaining creation with a controller provided externally.
This way, depending on what is being played in the service controller and what the user wants to play, we can reuse the service controller with the updated Letterbox logic above and pass it to the media player view controller for display. We can then probably eliminate all original...
-based ugly code and simplify our implementation of -playURN
or -playMedia
in Play.
This behavior exists since a long time, I propose we fix it for 3.1.1.
The same issue affects livestreams, for all platforms (including CarPlay where it can be a bit more annoying):
- Play some radio channel.
- Go back, then tap on the channel again.
- Playback is reset.