Skip to content
This repository has been archived by the owner on Jan 12, 2019. It is now read-only.

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

Closed
maddygoround opened this issue Jul 13, 2016 · 9 comments
Closed

Comments

@maddygoround
Copy link

maddygoround commented Jul 13, 2016

Description

When working with HLS 128 encrypted stream, the module make request for key for every chunk.
Why we need to make request every-time for chunk when we already have the key from the first request to key.

Following is the key object already in the segment.

"{"method":"AES-128","uri":"10minscat.key","iv":{"0":89807546,"1":1232804682,"2":2466904456,"3":792036832},"resolvedUri":"http://server-url/10minscat.key","bytes":{"0":664287445,"1":1803566766,"2":1398338856,"3":643511093}}"

Following is the screenshot of segment calls
request

On other end streamroot HLS plugin makes the request for key only once.
https://github.com/streamroot/videojs5-hlsjs-source-handler

Results

Expected

We expect the calls to the key only once.

Actual

The call for the key is done for each and every chunk.

versions

videojs-contrib-hls

videojs-contrib-hls 3.1.0

videojs

video.js 5.10.4

browsers

Chrome
*

Operating Systems

Windows10
*

plugins

https://github.com/streamroot/videojs5-hlsjs-source-handler

@maddygoround maddygoround changed the title HLS 128 playback request key for every chunk. HLS AES 128 playback request key for every chunk. Jul 13, 2016
@maddygoround maddygoround changed the title HLS AES 128 playback request key for every chunk. While doing HLS AES 128 playback, the player request key for every chunk. Jul 13, 2016
@gkatsev
Copy link
Member

gkatsev commented Jul 13, 2016

Do you have a link to your m3u8 or an example m3u8?

@maddygoround
Copy link
Author

@gkatsev
Copy link
Member

gkatsev commented Jul 13, 2016

Looks like a bug.

@maddygoround
Copy link
Author

good to know.

@ellyjonez
Copy link

Any movement here? I've noticed this happening as well, on OSX Chrome and OSX Firefox. I am concerned it may be contributing to an uptick in complaints from our users about video stopping to buffer too much.

videojs version: 5.10.7
vjs-hls-contrib version: 3.5.3

here's a screenshot of what I'm seeing. (those POSTs to viewing_events.json is our event tracker at work):

screen shot 2016-10-03 at 12 11 33 am

@coltontravers
Copy link

+1 I'm currently having the same issue. It also seems like the server with the key (out of my control) isn't happy with requests, and throws 403 errors sometimes that eventually break the stream.

@benvirus
Copy link

benvirus commented Oct 7, 2016

I've solved this problem and will make a pull request as soon as possible.Be patient.

@dmlap
Copy link
Member

dmlap commented Oct 31, 2016

The browser should be applying standard caching rules to the XHRs for keys. @maddygoround @benvirus @colt082295, do you have caching headers setup for your keys? Also, make sure you have caching turned on if you're watching requests in the developer console. I'm pretty sure caching is turned off when the dev console is open by default.

@gesinger
Copy link
Contributor

Thanks to all for reporting the find and adding information. As @dmlap mentioned, we use the browser cache to handle the caching of key requests. While we might be able to do the caching of the key ourselves, we'd have to be aware of potential "HTTP expires" headers to handle mentioned key rotation and make other considerations in the code. As of now, it is simpler to make use of the browser cache.

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

No branches or pull requests

7 participants