Search code examples
androidchromecastgoogle-cast

Don't use default Player Control page when initializing Cast Companion Library


The documentation says that you should specify the class of the activity you want to be shown when you call the initialize method. If you leave it null, then the default Player Control page will be shown. However, the default Player Control page is shown even if I set the third parameter to the activity that I'm casting from:

mCastMgr = VideoCastManager.initialize(context, APPLICATION_ID, com.square.RadioActivity.class, "urn:x-cast:com.square.radio");

Please help.


Solution

  • Are you still calling startCastControllerActivity(..)? If so, don't. Since you want to start your own activity, you should start it in a way and shape that you want, there is no magic involved (take a look at the implementation(s) of startCastControllerActivity(), it creates an intent, sets a couple of extras and starts the activity). The parameter that you passed into the initialize is used from (a) MiniController and (b) Notification; in those two places, you can click on the icon and start your own activity that you declared. Take a look at those two places to see what is being passed in those places so that you can make your Activity handle those extras.