Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xhr.withCredentials value not used by SegmentBaseLoader.js #1672

Closed
4 of 5 tasks
rolfkoizumi opened this issue Nov 19, 2016 · 5 comments
Closed
4 of 5 tasks

xhr.withCredentials value not used by SegmentBaseLoader.js #1672

rolfkoizumi opened this issue Nov 19, 2016 · 5 comments

Comments

@rolfkoizumi
Copy link

rolfkoizumi commented Nov 19, 2016

I can provide more information if needed. We are testing private streams with restricted access and I don't have a public site at the moment.

Environment
  • Link to playable MPD file: -
  • Dash.js version: 2.3.0
  • Browser name/version: Chrome 54.0.2840.71/ Firefox 47.0.1
  • OS name/version: Windows 10
Setup
  • S3 Bucket with CORS settings
  • Cloudfront with restricted access (signed Cookies)
  • dash.js 2.3.0 is loaded and player.setXHRWithCredentials(true); is set
Observed Behaviour with restricted access turned on

Screenshot

  • The .mpd-playlist is requested by XHRLoader.js, Cloudfront cookies are sent and response is okay
  • CORS preflight OPTIONS requests for segments are made by SegmentBaseLoader.js and return okay
  • GET requests for the segments are automatically made but cookies are not sent and Cloudfront returns 403 (SegmentBaseLoader.js doesn't use the xhr.withCredentials value)
Observed Behaviour with restricted access turned off

Screenshot

  • The .mpd-playlist is requested by XHRLoader.js, Cloudfront cookies are sent and response is okay
  • CORS preflight OPTIONS requests for segments are made by SegmentBaseLoader.js and return okay
  • GET requests for the segments are automatically made but cookies are not sent. This returns okay now because restricted access by cloudfront is turned off
  • OPTIONS and GET requests for ranges of the dash.stream are made by XHRLoader.js, cookies are sent with the GET requests as expected
Conclusion and quickfix

So somehow only the first requests made by the SegmentBaseLoader.js does not check if player.setXHRWithCredentials(true) was set. Requests made by the XHRLoader.js checks this.
By adding request.withCredentials = true; right before request.send, I could quickfix this.
If I just used the player terribly wrong, please let me know.

Screenshot with custom quickfix and restricted access on

  • now cookies are sent for those first GET requests and video can be played
@davemevans
Copy link
Contributor

Related: #1254

@alanimgur
Copy link

+1 Running into the exact same issue

@davemevans
Copy link
Contributor

davemevans commented Jan 24, 2017

@alanimgur, @rolfboom I did a quick patch (davemevans@b1dd056) a while ago but only tested a couple of public streams - can you test against your content since you have not made it available? Assuming it looks good I will PR.

@alanimgur
Copy link

alanimgur commented Jan 25, 2017

@bbcrddave @rolfboom It works! Thank you!

  1. I took development...bbcrddave:UseXHRLoaderForSegmentBase and merged it to my fork here Fix #1672, #1254 - use XHRLoader for SegmentBase requests alanimgur/dash.js#1
  2. Installed via npm npm install --save https://github.com/alanimgur/dash.js/tarball/development
  3. I verified that it does indeed send cookies with the requests, and loads the video in all of it's DASH glory.

@davemevans
Copy link
Contributor

Sweet, thanks. I've created PR #1760 and hopefully it should go into the 2.4.1 release next week.

LloydW93 pushed a commit that referenced this issue Jan 25, 2017
Fix #1672, #1254 - use XHRLoader for SegmentBase requests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants