0
votes

I have problem with launching Google-Cast application similar to sample CastHelloText-chrome. I slightly modified example code for my specific purposes. The goal for creating this application is to send and show image data directly in Chromecast device.

Particularly the difference between official sample and my code is in message format and its content, sent by sender application. Sender application took png image coded by base64 and send through message bus with custom namespace. Receiver application get this message and use this as data source for html object <img>.

Error appears when I do this steps:

  1. Reload sender page, checking console if any device found.
  2. Send the form by just pushing enter on input box (text is ignored).
  3. Now a popup from Chromecast extension shows. Next there are two scenarios:

    3a) I confirm casting to device by choosing one from the list, then I get this error message in console:

    onError: {"code":"channel_error","description":"Error: Timeout","details":null}

    3b) I just click somewhere else, I get this error:

    onError: {"code":"cancel","description":"User closed popup menu","details":null}

    Both of errors are caused by calling function chrome.cast.requestSession in chromehellotext.html at line 161, but what's really wrong I don't know.

When I step sender script I realize that function sessionListener is never called. I know that something go wrong when code try to call chrome.cast.requestSession, where described error raises. So I need help if I missed about right way to use Google-Cast API or If this problem has something to do with networking issues.

Receiver application is registered on Google Cast SDK Developer Console and I'm testing on registered device with some serial number. I'm using Google Chrome in version 42.0.2300.2 canary (64-bit) and Chrome version 40.0.2214.111 (current stable I suppose). For testing I also tried to turn off Windows Firewall entirely but with no luck.

Edit: There were some syntactic errors that caused error message described above.

3

3 Answers

1
votes

It seems like you are trying to use the data/control channel to send an image; please don't do that; that channel is not meant to be used for large data communications; in fact it cannot send anything which approaches or exceeds 64k. If your goal is to send images from your local machine, you would need to run a local web server on your local machine and serve images through the web server.

1
votes

For and easiest tutorial you can have a look to this tutorial. It is well explained in this tutorial. Chromecast Sender application

There is no need to maintain session by yourself. just add button and enjoy casting

mCastManager.addMediaRouterButton(mediaRoutebtn);
0
votes

I found a source of my problem. There was something wrong in receiver code - syntactic and runtime errors, so I must admit that my code wasn't functional. Now its working in terms of launching application and getting session.

Unfortunate thing is that the error message generated by Chromecast extension didn't match the actual error - at least it was a bit confusing when I didn't know what's really happening on receiver side without ability to debug the code.