SRGSSR / srgletterbox-apple

The official SRG SSR media playback experience
https://srgssr.github.io/marketing/letterbox/
MIT License
14 stars 7 forks source link

AirPlay external playback interruptions #206

Closed defagos closed 4 years ago

defagos commented 4 years ago

AirPlay external playback might be interrupted in some cases, for example when calling a playback method for a media already being externally played.

The reason is that the current implementation performs unnecessary resets of the AVPlayer allowsExternalPlayback property. We must avoid setting this property to NO unnecessarily when it was YES and we still want the value to be YES afterwards.

In other words, if allowsExternalPlayback is YES at some point,

player.allowsExternalPlayback = NO;
player.allowsExternalPlayback = YES;

is not equivalent to doing nothing. The temporary reset to NO will trigger a brief AirPlay interruption.

defagos commented 4 years ago

Fixed on the feature/airplay-short-interruption-fix branch.