3
votes

I'm trying to test some chromecast examples using chrome, but can't see the chromecast in the available receiver list for my APP-ID.

This is my situation,

  • My chromecast device is whitelisted. I received my APP-ID associated with my receiver urls.

  • I can get access to my receiver url, using the browser and it is exactly the same url associated with my App ID.

  • The receiver.html has something like this:

var receiver = new cast.receiver.Receiver( 'APP-ID', ['Test'], "", 5);

The APP-ID is the one I received when I whitelisted the chromecast device.

  • The receiver.html is hosted with a public ip. It is accessible for everyone.

  • The sender.html:

    var appId = "APP-ID";

    $window.addEventListener("message", function(event) {

    if (event.source == window && event.data &&
        event.data.source == "CastApi" &&
        event.data.event == "Hello") {
      $log.info("CastApi Hello message received!");
      initializeApi();
    }
    

    });

    var initializeApi = function() {

    cast_api = new cast.Api();
    cast_api.addReceiverListener(appId, **onReceiverList**);
    

    };

    var onReceiverList = function(list) {

    $scope.receivers = list;
    var fn = list.length ? $log.info : $log.warn;
    fn("Receivers: ", list);
    $scope.$apply();
    

    };

THE PROBLEM is the receiver list is always empty!!!

  • The sender.html is hosted in my localhost server and I whitelisted it with the word "localhost" in the option page of chromecast extension.

  • I check the option "Send this Chromecast's serial number when checking for updates" when I was setting up the chromecast the first time with Chrome (No Android). I'm able to access to debug mode using the url http://MY-CHROMECAST-IP*:9222 so I'm sure it's working.

Don't know what I am missing.

Someone could help me?

2
Restart your ChromeCast device to make sure the serial number is sent to Google.Leon Nicholls
I did it using android app but nothing change.I am still having the same problem.rushmore
Ok, I figured out what's going on. I was running the example in ubuntu!!! when I tested in OSX it works fine!!!!!rushmore

2 Answers

1
votes

I had this issue on windows 7 on 2 different networks.

People on OSX and Linux see an available receiver without issues.

The tab itself can see the chromecast, and all other chromecast actions on the PC works correctly, but when I ask the JS API if there is any any receiver is there, its always empty.

This is regardless of whether the app is published or not.

Seems like there is a legitimate bug in the API that needs to be addressed by Google.

0
votes

The ideal scenario would be to host the receiver locally during development so you can make and save changes and see them represented on the Chromecast device immediately without the need to push your changes to a publicly accessible server.

To achieve this I used https://meetfinch.com/ and it worked really great. After installing and registering (which is free), run this:

finch forward http://localhost:8080