2
votes

I am trying to play an HLS stream on my chromecast custom receiver. However i'm having authentication issues fetching the m3u8 files because my server requires a cookie.

The request to get the root m3u8 file has a 'Set-Cookie' header which needs to be considered when fetching the sub-m3u8 files in my stream (to pass server authentication). I would like to know if its possible to have cookies set when the receiver app fetches the media.

1

1 Answers

1
votes

Try something like:

window.mediaHost = new cast.player.api.Host({
  'mediaElement': window.mediaElement,
  'url': url
});

window.mediaHost.updateManifestRequestInfo = function(requestInfo) {
  if (!requestInfo.url) {
      requestInfo.url = this.url;
  }
  requestInfo.withCredentials = true;
};

window.mediaHost.updateLicenseRequestInfo = function(requestInfo) {
  requestInfo.withCredentials = true;
};

window.mediaHost.updateSegmentRequestInfo = function(requestInfo) {
  requestInfo.withCredentials = true;
};