title: Is there a way to show a Chromecast button inside a WebView?
body: <p>I am currently developing an Android application using Cordova. This working fine so far, but now that I want to add a Chromecast button to the UI, it does not seem to work. I followed the instructions provided here: <a href="https://developers.google.com/cast/docs/chrome_sender/integrate" rel="nofollow noreferrer">https://developers.google.com/cast/docs/chrome_sender/integrate</a></p>
  
  <p>And this is what my code looks so far:</p>
  
  <pre><code>        var CastPlayer = function() {
              //...
              /* Cast player variables */
              /** @type {cast.framework.RemotePlayer} */
              this.remotePlayer = null;
              /** @type {cast.framework.RemotePlayerController} */
              this.remotePlayerController = null;
              //...
          };
  
          var castPlayer = new CastPlayer();
          window['__onGCastApiAvailable'] = function(isAvailable) {
              if (isAvailable) {
                  castPlayer.initializeCastPlayer();
              }
          };
  </code></pre>
  
  <p>Inline script inside my index.html.</p>
  
  <pre><code>CastPlayer.prototype.initializeCastPlayer = function() {
  
  var options = {};
  
  // Set the receiver application ID to your own (created in the
  // Google Cast Developer Console), or optionally
  // use the chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID
  options.receiverApplicationId = chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID;
  
  // Auto join policy can be one of the following three:
  // ORIGIN_SCOPED - Auto connect from same appId and page origin
  // TAB_AND_ORIGIN_SCOPED - Auto connect from same appId, page origin, and tab
  // PAGE_SCOPED - No auto connect
  options.autoJoinPolicy = chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED;
  
  cast.framework.CastContext.getInstance().setOptions(options);
  
  this.remotePlayer = new cast.framework.RemotePlayer();
  this.remotePlayerController = new cast.framework.RemotePlayerController(this.remotePlayer);
  this.remotePlayerController.addEventListener(
      cast.framework.RemotePlayerEventType.IS_CONNECTED_CHANGED,
      this.switchPlayer.bind(this)
  );
  };
  </code></pre>
  
  <p>Content of my index.js.</p>
  
  <p>In the index.html, I added the button like this:</p>
  
  <pre><code>&lt;google-cast-launcher id="castbutton"&gt;&lt;/google-cast-launcher&gt;
  </code></pre>
  
  <p>Now when I open my Cordova app via browser (Chrome AND Chromium), the cast button shows and I can use it normally. When I open the App on Android, the Button just does not show. Does anybody know what causes this and if it can be resolved?</p>