From 421dfbf2c0d048f529c1d14a17032be6f376e134 Mon Sep 17 00:00:00 2001 From: Frank Riley Date: Thu, 7 May 2020 21:04:26 -0700 Subject: [PATCH] Fix #1210: Add credentials to XHR requests --- src/components/htmlaudioplayer/plugin.js | 8 +++++++- src/components/htmlvideoplayer/plugin.js | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/components/htmlaudioplayer/plugin.js b/src/components/htmlaudioplayer/plugin.js index c3a5484aca..000af6f226 100644 --- a/src/components/htmlaudioplayer/plugin.js +++ b/src/components/htmlaudioplayer/plugin.js @@ -136,7 +136,10 @@ define(['events', 'browser', 'require', 'apphost', 'appSettings', 'htmlMediaHelp requireHlsPlayer(function () { var hls = new Hls({ - manifestLoadingTimeOut: 20000 + manifestLoadingTimeOut: 20000, + xhrSetup: function(xhr, url) { + xhr.withCredentials = true; + } //appendErrorMaxRetry: 6, //debug: true }); @@ -155,6 +158,9 @@ define(['events', 'browser', 'require', 'apphost', 'appSettings', 'htmlMediaHelp elem.autoplay = true; + // Safari will not send cookies without this + elem.crossOrigin = 'use-credentials'; + return htmlMediaHelper.applySrc(elem, val, options).then(function () { self._currentSrc = val; diff --git a/src/components/htmlvideoplayer/plugin.js b/src/components/htmlvideoplayer/plugin.js index f87fd19462..de2c364aee 100644 --- a/src/components/htmlvideoplayer/plugin.js +++ b/src/components/htmlvideoplayer/plugin.js @@ -330,7 +330,10 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa requireHlsPlayer(function () { var hls = new Hls({ - manifestLoadingTimeOut: 20000 + manifestLoadingTimeOut: 20000, + xhrSetup: function(xhr, xhr_url) { + xhr.withCredentials = true; + } //appendErrorMaxRetry: 6, //debug: true }); @@ -551,6 +554,9 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa elem.autoplay = true; + // Safari will not send cookies without this + elem.crossOrigin = 'use-credentials'; + return htmlMediaHelper.applySrc(elem, val, options).then(function () { self._currentSrc = val;