3

The problem is that cast icon is not visible even in sample examples by Google in sender application. Month ago i had to refresh the page couple of times to get an icon back or restart the device. Now nothing is working and the icon is missing but in chrome development tools it shows that it is correctly implemented. Do you know what is the problem?

I am creating cast button by:
google-cast-launcher

there are no errors in console

PS. I do also have had implemented the library https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1

Community
  • 1
  • 1

2 Answers2

1

I found a solution. You need to use https:// instead of http:// otherwise the cast icon wont be visible

I hope it helps some of you

@edit if you have problem with not showing icon and in console it shows :

CastVideos.js:125 Uncaught ReferenceError: cast is not defined
    at CastPlayer.initializeCastPlayer (CastVideos.js:125)
    at window.__onGCastApiAvailable (CastVideos.js:1004)
    at chrome.cast.ha (VM1365 cast_sender.js:99)

in your html put script at the beggining of head and script to framework gstatic at the end of body.

0

You have to delay the initialization of Cast Player

let castPlayer = new CastPlayer();
window['__onGCastApiAvailable'] = function (isAvailable) {
  if (isAvailable) {
    setTimeout(() => {
      castPlayer.initializeCastPlayer();
    }, 1000)
  }
};

Hiren
  • 35
  • 1
  • 6