SRGSSR / playsrg-apple

The Play SRG applications for iOS and tvOS
https://srgssr.github.io/playsrg-apple/
MIT License
44 stars 3 forks source link

Playback incorrectly jumps when playing parent of segment already being played #154

Open defagos opened 4 years ago

defagos commented 4 years ago

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

Reproducibility

Always reproducible

Code sample

Steps to reproduce

  1. Enable background video playback (segments are for on-demand content mostly).
  2. Play a 19h30 segment, either directly or as part of normal playback (no active selection required).
  3. Close the player. Playback continues in the background.
  4. 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.

defagos commented 4 years ago

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:

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.

defagos commented 2 years ago

The same issue affects livestreams, for all platforms (including CarPlay where it can be a bit more annoying):

  1. Play some radio channel.
  2. Go back, then tap on the channel again.
  3. Playback is reset.