Skip to content
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

Prevent SRG SSR livestreams from being played in the past #94

Closed
3 tasks done
defagos opened this issue Oct 10, 2022 · 3 comments · Fixed by #99
Closed
3 tasks done

Prevent SRG SSR livestreams from being played in the past #94

defagos opened this issue Oct 10, 2022 · 3 comments · Fixed by #99
Assignees
Labels
enhancement New feature or request

Comments

@defagos
Copy link
Member

defagos commented Oct 10, 2022

As member of the legal team I don't want users to be able to pause livestreams, thus avoiding a kind of timeshift feature to be available on such streams.

Acceptance criteria

  • Livestreams without DVR are stopped instead of paused.
  • This behavior must also work in the future with AirPlay or picture in picture.

Tasks

  • Resume SRG SSR livestreams to the live edge after a pause.
  • Add example under the showcase tab.
  • Test with poor network conditions.
@defagos defagos changed the title Pause for livestreams Pausing livestreams must stop playback Oct 10, 2022
@defagos defagos self-assigned this Oct 10, 2022
@defagos defagos added the enhancement New feature or request label Oct 10, 2022
@defagos
Copy link
Member Author

defagos commented Oct 11, 2022

There is no need to stop a livestream when paused or to implement any kind of other contrived mechanism (e.g. replacing the current livestream item with a copy or some silly similar idea). Digging through AVFoundation APIs (#97) I namely found automaticallyPreservesTimeOffsetFromLive, available from iOS and tvOS 13, which allows us to control whether livestream playback always resumes at the live edge once the buffer has been exhausted.

Looking at network activity with Charles it seems that AVPlayer is quite conservative and still loads many chunks ahead by default when a livestream is paused. We thus should limit buffering by setting a low value for the item preferredForwardBufferDuration.

We can enable this flag in CoreBusiness to ensure SRG SSR livestreams conform to this rule and cannot be played in the past if they do not support DVR.

@defagos defagos moved this from 👍 Ready to 🚧 In Progress in Pillarbox Oct 11, 2022
@defagos
Copy link
Member Author

defagos commented Oct 11, 2022

Works fine with poor network conditions (network link conditioner with Edge settings).

@defagos defagos changed the title Pausing livestreams must stop playback Prevent SRG SSR livestreams from being played in the past Oct 11, 2022
@defagos defagos linked a pull request Oct 11, 2022 that will close this issue
5 tasks
@defagos
Copy link
Member Author

defagos commented Oct 11, 2022

The buffering limitation strategy applied here to prevent livestream playback in the past has advantages over the approach previously used in Letterbox (implementing a stop which discarded the internal AVPlayer instance):

  • We don't need any special stopped state.
  • We don't need any dedicated API.
  • We never discard the player (something we should strive to avoid, except maybe if we want to implement graceful recovery from media service reset).
  • Each item can have a different policy. We could namely have implemented this feature at the player level (rather than at the item level) with a seek to the default position always made when resuming playback, but the behavior would have been forced to all contents in the same way.

Repository owner moved this from 🚧 In Progress to ✅ Done in Pillarbox Oct 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant