SRGSSR / srgmediaplayer-apple

An advanced media player library, simple and reliable
MIT License
159 stars 33 forks source link

Chromecast support #25

Closed cl3m closed 6 years ago

cl3m commented 7 years ago

Issue overview

Chromecast support would be a great even on iOS. Many media player do support it (ARTE, Vimeo, YouTube, ..). More info at https://developers.google.com/cast/docs/developers

defagos commented 7 years ago

Sorry for the late answer. Yes, this is definitely something we intend to deliver in a hopefully not so distant future. What remains to be investigated is whether Chromecast support must be actually implemented in the library or not.

Given the recent changes of Chromecast V3, it seems possible that Chromecast support could be better implemented at the application level. We should provide all necessary hooks in our library, of course. We could maybe provide a companion framework as well to fill the gap.

defagos commented 6 years ago

The implementation of Google Cast in our application (itself based on SRG MediaPlayer) is almost finished, and I now understand how Google Cast works and how it must be integrated in applications. I can therefore properly answer your feature request:

For all these reasons, I am now convinced that SRG MediaPlayer cannot provide any Google Cast integration. SRG MediaPlayer controller is strongly related to an AVPlayer instance and therefore promotes SRG MediaPlayer controllers as authorities to control playback. This is in direct opposition to how Google Cast works, with the receiver being the playback authority, and the device only a remote control.

Google Cast integration is moreover the responsibility of the application itself, since SRG MediaPlayer must not make any assumptions about the view controller hierarchy and how Google Cast player views should be presented. Moreover, SRG MediaPlayer has no access to metadata information it could supply to Google Cast, unlike the application itself. Attempting to provide additional abstractions to provide for such flexibility at the SRG MediaPlayer level would lead to additional complexity.