SRGSSR / pillarbox-apple

A next-generation reactive media playback ecosystem for Apple platforms.
https://testflight.apple.com/join/TS6ngLqf
MIT License
43 stars 6 forks source link

Support opening and end credits #845

Closed defagos closed 3 weeks ago

defagos commented 3 weeks ago

As a user I want to be able to skip opening credits. I might also want to later have a content proposal during the end credits.

Acceptance criteria

Tasks

defagos commented 3 weeks ago

If naively following the official documentation and periodically updating contextualActions associated with an AVPlayerViewController, the button flickers.

To avoid flickering it suffices to provide a stable identifier with each UIAction. This way the player view controller can detect if there is a change or not.

In our case, and even if this might not cover all cases, we will use the title as identifier. This will not cover cases where buttons associated with consecutive time ranges offer the same label but a different handler, but such cases are rather unlikely to happen (and if they happen we will figure out another approach).

Moreover, some properties associated with actions are not supported by tvOS, e.g. the subtitle or selectedImage. For this reason we will roll our own ContextualAction that provides an identifier matching the button title, and reduced customization compatible with AVPlayerViewController.

defagos commented 3 weeks ago

There is no contextual action support for the AVPlayerViewController on iOS. We will therefore mark the API as available on tvOS only and update it if Apple later extends it to iOS as well. We could have introduced a button ourselves but this would have been fragile.