iOS chrome cast castProvider shared instance

Hi. I have integrated the kaltura sdk with chrome cast support in my multi view iOS app.

I need to have an option where the user can connect to a chrome cast device from any view. And then in any other views that play videos (and have a KPViewController), when the video plays it should automatically connect to the chrome cast device.

I have created a ChromecastManager sharedInstance class, which contains a KCastProvider, and it is through this class that I connect to a selected device.

Problem number 1 - At this point I simply connect to the device via the KCastProvider. I can’t work out a way to set the logo at this point. Previously I had a KPlayerConfig that had the key: “chromecast.logoUrl”. But when initially connecting I don’t have a KPViewController, and therefore no config. How can I set the logo from the KCastProvider level?


When I open a screen that contains a video (and therefore a KPViewController), when the player state changes to playable, I then set the KPViewController.castProvider to use the ChromecastManager shared instance cast provider. This then loads the video onto the chrome cast device as expected.

Problem 2 - When I then exit the video view, and go into a different video screen, I create a new KPViewController and set the castProvider to use the global one again. However, the video doesn’t change, and still plays the old one. If, when I exit the video view I tell the castProvider.mediaRemoteControl to stop(), it does stop the video, but then I can’t play any more videos and no other connections can be made.

Any ideas? Are there any examples of using a shared instance castProvider?

Hey @michalmichal,

Can you attach more details, about Kaltura SDK version and Google cast version number?

Thanks,

Eliza

cc @oren_melamed