title: Chromecast DRM example
body: <p>I am referring to this example given by Google (sender.js file in particular) (<a href="https://github.com/googlecast/CastMediaPlayerStreamingDRM/blob/master/sender.js" rel="nofollow">https://github.com/googlecast/CastMediaPlayerStreamingDRM/blob/master/sender.js</a>). I am trying to play the http: //storage.googleapis.com/wvmedia/cenc/tears.mpd file which is DRM and I am passing in the license URL http:// widevine-proxy.appspot.com/proxy as defined in the sender.js file in the example.</p>
  
  <p>My sender is Android (I am using the CastCompanionLibrary). This is how I am sending it in Android:</p>
  
  <pre><code>mCastManager.sendDataMessage("http://playready.directtaps.net/pr/svc/rightsmanager.asmx");
  mCastManager.startCastControllerActivity(LocalPlayerActivity.this, media, 0, true);
  </code></pre>
  
  <p>This is how I am receiving the license URL in the my custom receiver:</p>
  
  <pre><code>messageBus = castReceiverManager.getCastMessageBus(--NAME SPACE--);
  
  messageBus.onMessage = function(event) {
  
          console.log(event['data']);
          licenseURL = event['data'];
          console.log(licenseURL);
  
      }
  </code></pre>
  
  <p>So far I have debugged and licenseURL is set to the license URL sent by the Android sender. It is receiving the licenseURL properly in the receiver. Then in my onLoad method I do the following. </p>
  
  <pre><code> mediaManager.onLoad = function(event) {
  
          if(mediaPlayer !== null) {
              mediaPlayer.unload(); // Ensure unload before loading again
          }
  
          if (event.data['media'] &amp;&amp; event.data['media']['contentId']) {
              var url = event.data['media']['contentId'];
  
              mediaHost = new cast.player.api.Host({
                  'mediaElement': mediaElement,
                  'url': url
              });
  
              mediaHost.onError = function (errorCode) {
                  console.error('### HOST ERROR - Fatal Error: code = ' + errorCode);
  
                  if (mediaPlayer !== null) {
                      mediaPlayer.unload();
                  }
              }
  
              if(licenseURL){
  
                  console.log("##License URL is not null");
                  mediaHost.licenseURL = licenseURL;
              }
              var initialTimeIndexSeconds = event.data['media']['currentTime'] || 0;
  
              var protocol = null;
  
              var parser = document.createElement('a');
              parser.href = url;
  
              var ext = ext = parser.pathname.split('.').pop();
              if (ext === 'm3u8') {
                  protocol =  cast.player.api.CreateHlsStreamingProtocol(mediaHost);
              } else if (ext === 'mpd') {
                  protocol = cast.player.api.CreateDashStreamingProtocol(mediaHost);
              } else if (ext === 'ism/') {
                  protocol = cast.player.api.CreateSmoothStreamingProtocol(mediaHost);
              }
              console.log('### Media Protocol Identified as ' + ext);
  
  
              if (protocol === null) {
  
                  mediaManager['onLoadOrig'](event); // Call on the original callback
              } else {
  
                  mediaPlayer = new cast.player.api.Player(mediaHost);
                  mediaPlayer.load(protocol, initialTimeIndexSeconds);
              }
          }
      }
  </code></pre>
  
  <p>But when I do this I am getting the error: </p>
  
  <pre><code>XMLHttpRequest cannot load http://storage.googleapis.com/wvmedia/cenc/tears.mpd. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://dl.dropboxusercontent.com' is therefore not allowed access.
  ### HOST ERROR - Fatal Error: code = 3 
  </code></pre>
  
  <p>I am hosting the receiver temporarily on dropbox public folder. Any ideas as to what I am doing wrong?</p>