Chromecast Receiver App Cookies [英] Chromecast Receiver App Cookies

查看:72
本文介绍了Chromecast Receiver App Cookies的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在chromecast自定义接收器上播放HLS流。但是,由于我的服务器需要Cookie,因此在提取m3u8文件时遇到身份验证问题。

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.

获取根m3u8文件的请求具有一个 Set-Cookie标头,在获取我的流中的sub-m3u8文件(通过服务器)时需要考虑该标头身份验证)。我想知道是否可以在接收方应用程序获取媒体时设置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.

推荐答案

请尝试以下操作:

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;
};

这篇关于Chromecast Receiver App Cookies的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆