0

I am writing an Android App which is playing YouTube videos. I am working on adding Chromecast support to my app. I learnt from various questions posted on Stack Overflow that YouTube SDK does not provide direct APIs to cast videos from your own app. Following the suggestions provided, I wrote my own custom receiver and have published it too. However, when I am calling launchApplication from my app, I am always getting status as 15 in onResult.

Cast.CastApi.launchApplication(mApiClient, APP_ID).setResultCallback(
                    new ResultCallback<Cast.ApplicationConnectionResult>() {
                    @Override
                    public void onResult(Cast.ApplicationConnectionResult applicationConnectionResult) { }
}

I learnt that 15 means Timeout. But my receiver does get launched and I am able to see my HTML page getting loaded on TV when I connect to Chromecast through app.

    mMediaRouter = MediaRouter.getInstance(getApplicationContext());

    mMediaRouteSelector = new MediaRouteSelector.Builder().addControlCategory(CastMediaControlIntent.categoryForCast(APP_ID)).build();
    mMediaRouteButton.setRouteSelector(mMediaRouteSelector);
    mMediaRouterCallback = new MediaRouterCallback();

As my lauchApplication call fails, my sendMessage is not able to send the required signal to the Chromecast.

I am very new to chromecast and I have limited experience in working on it's integration with android app. I would really appreciate if anyone can tell me, what could be an issue.

Keya
  • 859
  • 3
  • 9
  • 17
  • Since you are using a custom receiver, it is not possible to say what you are doing incorrectly. When you call launchApplication, how does your receiver respond back to the sender? – Ali Naddaf Mar 18 '16 at 16:31
  • I haven't aded any custom status callback at receiver end. Even my receiver is just a basic version where it is expected to play a hard-coded youtube video when a message is received. Can you please tell me how I can modify my receiver to send a response back to server? Thanks. – Keya Mar 20 '16 at 11:33
  • You may want to read through https://developers.google.com/cast/docs/custom_receiver to get a better feel for what is happening and how you can customize various things. – Ali Naddaf Mar 20 '16 at 15:28
  • Thanks Ali. I found few issues with the customer receiver HTML file that I had written. Fixing that, I could establish communication between my sender and receiver. The timeout primarily was happening because of some crashes observed in loading receiver. Remote debugging helped in resolving the issues. Thank you. – Keya Mar 21 '16 at 04:54

0 Answers0