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

Stream with URL with CDN token and media chunk downloading #2324

Closed
herrsiim opened this issue Dec 6, 2017 · 3 comments
Closed

Stream with URL with CDN token and media chunk downloading #2324

herrsiim opened this issue Dec 6, 2017 · 3 comments
Labels

Comments

@herrsiim
Copy link

herrsiim commented Dec 6, 2017

Hello,

We are trying to play a stream that includes CDN tokens. If the token is not in the url, the file is forbidden for downloading. For security reasons, I am not able to share you the real url, but here is the example:

http://.../1-0-alwo-2015/video/Manifest.mpd?28XZGQhD_qD6d3YccM6384g9PoaO4tQpt0DcwGglPG_1yKJuK8bausubS0nc8Q7fuZmkUlrgYzsoQd3wlV6k7kBJH9r965YS7ow

If I remove the token from url, the stream will not start, as the manifest is forbidden for downloading:

http://.../1-0-alwo-2015/video/Manifest.mpd

If I start the stream, then the manifest is downloaded correctly, but as soon as the dashjs starts downloading audio and video chunks then it fails. The reason for this is that the same token should be added into each chunk request URL.

This URL for media chunk fails:

http://.../1-0-alwo-2015/video/video-H264-396-1000k_dashinit.mp4

This URL will download file:

http://.../1-0-alwo-2015/video/video-H264-396-1000k_dashinit.mp4?28XZGQhD_qD6d3YccM6384g9PoaO4tQpt0DcwGglPG_1yKJuK8bausubS0nc8Q7fuZmkUlrgYzsoQd3wlV6k7kBJH9r965YS7ow

I've tried this:
player.setXHRWithCredentialsForType("MediaSegment", true);

and this:
player.setXHRWithCredentials(true);

Is there any support for this in dashjs or should we modify player according to our needs.

Any help on this will be greatly appreciated! Thanks

@davemevans
Copy link
Contributor

You will need to extend the RequestModifier module and add the token to the segment URLs using modifyRequestURL, as described in #1471 (comment)

@epiclabsDASH
Copy link
Contributor

@herrsiim, two alternative approaches commonly used that avoids you to extend the client:

  • Include the token in the mpd when defining media (chunks) urls. This implies returning a different mpd to each user that is not always possible.
  • Use a query string token for mpd request. Use a cookie based token for the next ones.

@epiclabsDASH
Copy link
Contributor

Closing this one. @herrsiim, please feel free to reopen this one in case something is not clear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants