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

While doing HLS AES 128 playback, the player request key file for every chunk. #367

Closed
riubin opened this issue Jun 4, 2017 · 11 comments
Closed

Comments

@riubin
Copy link

riubin commented Jun 4, 2017

Description

I have the same question as this post:
videojs/videojs-contrib-hls#776

I want to control the key file request by php server script that only the valid user can get the AES key file. so I can not set cache expires of the key file.Therefor the php server been to very hevy. I had tried to modify mediaSegmentRequest function for check key.resovledUri and store the key value,but failed.
Is there any other way to fixed the proplem?
Thanks a lot!

videojs-contrib-hls version

videojs-contrib-hls 5.5.3

videojs version

video.js 5.19

@gesinger
Copy link
Contributor

gesinger commented Jun 9, 2017

Hey @riubin , why is it that the cache expires can't be set by the server?

@riubin
Copy link
Author

riubin commented Jun 10, 2017

Because the php server need check the session info by valid user that can watch the video. whatever, whether or not set cache expires the php server will be very hevy,but I do not want waste the resource of server. I think any others should have the problems too.
Thank you~

@riubin
Copy link
Author

riubin commented Jun 10, 2017

Add: The key file will be send to client by php script.client can't get key file directly.

@gesinger
Copy link
Contributor

Hey @riubin , the problem with caching the key requests by the player is if the keys do expire, the player has no way of knowing to fetch it again from the server. That's why the cache expires header is useful, and the caching can be done outside of the player.

@riubin
Copy link
Author

riubin commented Jun 16, 2017

I found @benvirus had fixed this problem by check key uri and store the key: https://github.com/videojs/videojs-contrib-hls/pull/865/files/87304c6c544d8eecd7de90acdd1685e7ee75a998..d308332bb58c6734aa6a3bc15a9a4a836997faa8
but in newer version it's not working anymore.My hls segments encypt with one key file,so the key uri is the same at all.can you add a option like "StoreKey:true",that will be good news for someone like me.

@benvirus
Copy link

benvirus commented Dec 7, 2017

You can fork the repo, add the cache key feature like me.

@forbesjo
Copy link
Contributor

We'll review videojs/videojs-contrib-hls#1433 and add this feature to the project

@forbesjo forbesjo transferred this issue from videojs/videojs-contrib-hls Jan 11, 2019
@welcome
Copy link

welcome bot commented Jan 11, 2019

👋 Thanks for opening your first issue here! 👋

If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.
To help make it easier for us to investigate your issue, please follow the contributing guidelines.

@phloxic
Copy link
Contributor

phloxic commented Feb 14, 2019

Seems related to #140

@gkatsev
Copy link
Member

gkatsev commented Apr 12, 2019

While we believe appropriate cache-control headers are the optimal solution, we've added an option to not re-request the key on every segment (#446). It is out in version 1.10.0.

@gkatsev gkatsev closed this as completed Apr 12, 2019
@hasinhayder
Copy link

hasinhayder commented Apr 8, 2021

Just add this to your options and it will be cached. I was suffering from the same issue with latest build, and finally figured it out

html5: {
    vhs: {
      cacheEncryptionKeys: true
    }
  }

notice the vhs, not hls :)

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

No branches or pull requests

7 participants