I initialize Google Cast SDK in my application: didFinishLaunching
like that:
let criteria = GCKDiscoveryCriteria(applicationID: kGCKDefaultMediaReceiverApplicationID)
let options = GCKCastOptions(discoveryCriteria: criteria)
GCKCastContext.setSharedInstanceWith(options)
I've tried to stream video content to Default Media Receiver and it works.
But I need to be able to change kGCKDefaultMediaReceiverApplicationID
to a custom receiver application id to send different content to a custom receiver application I've registered via Google Cast SDK Developer Console. I can't relaunch the app to specify a different application id.
Is there any way to do it dynamically at some point in the app after GCKCastContext.setSharedInstanceWith(options)
has already been called?
The call of this method works only once and I cannot update GCKDiscoveryCriteria: GCKCastContext.setSharedInstanceWith(options)
I use 'google-cast-sdk-no-bluetooth', version: 4.5.3
In Android SDK there is a method which can change the receiver app id on the fly: https://developers.google.com/android/reference/com/google/android/gms/cast/framework/CastContext#public-void-setreceiverapplicationid-string-applicationid
Unfortunately, I don't see anything like that in the iOS SDK :(
The only thing I found is this (inside GCKSessionManager):
/**
* Sets the default session options for the given device category.The session options are passed to
* the GCKDeviceProvider::createSessionForDevice:sessionID:sessionOptions: method when the user
* selects a device from the Cast dialog. For Cast sessions, the session options can specify which
* receiver application to launch.
*
* @param sessionOptions The session options. May be <code>nil</code> to remove any previously set
* options.
* @param category The device category.
*
* @since 4.0
*/
- (void)setDefaultSessionOptions:(nullable GCKSessionOptions *)sessionOptions
forDeviceCategory:(NSString *)category;
But there is no documentation on which sessionOptions and category to pass (category is probably kGCKCastDeviceCategory). It's not understandable which params exist and how to construct them.