-
Notifications
You must be signed in to change notification settings - Fork 428
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
fix: output-restricted event handling for unplayable streams #1305
Conversation
…form fastQualityChange_, update test
Codecov Report
@@ Coverage Diff @@
## main #1305 +/- ##
=======================================
Coverage 86.30% 86.31%
=======================================
Files 39 39
Lines 9842 9855 +13
Branches 2293 2298 +5
=======================================
+ Hits 8494 8506 +12
- Misses 1348 1349 +1
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
src/videojs-http-streaming.js
Outdated
@@ -1062,11 +1062,34 @@ class VhsHandler extends Component { | |||
|
|||
this.player_.tech_.on('keystatuschange', (e) => { | |||
if (e.status === 'output-restricted') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we change this to:
if (e.status !== 'output-restricted') {
return;
}
we can remove a level of indentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, should have done that.
src/videojs-http-streaming.js
Outdated
const masterPlaylist = this.masterPlaylistController_.media(); | ||
const excludedHDPlaylists = []; | ||
|
||
if (masterPlaylist && masterPlaylist.playlists) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same for this line too, we can return early if these aren't available.
src/videojs-http-streaming.js
Outdated
message: `DRM keystatus changed to ${e.status}. Playlist will fail to play. Check for HDCP content.`, | ||
blacklistDuration: Infinity | ||
}); | ||
const masterPlaylist = this.masterPlaylistController_.media(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.masterPlaylistController_.media()
actually returns the currently active media playlist. You want
http-streaming/src/master-playlist-controller.js
Line 1665 in 97e02fb
master() { |
const masterPlaylist = this.masterPlaylistController_.media(); | |
const masterPlaylist = this.masterPlaylistController_.master(); |
src/videojs-http-streaming.js
Outdated
// Assume all HD streams are unplayable and exclude them from ABR selection, then perform | ||
// a fastQualityChange to clear the buffer since it may already contain unplayable segments |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be better to move the second part of the comment ("...clear the buffer since it may already contain unplayable segments") above the call to fastQualityChange_
src/videojs-http-streaming.js
Outdated
if (!playlist.excludeUntil || playlist.excludeUntil < Infinity) { | ||
|
||
playlist.excludeUntil = Infinity; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if we need to check the current excludeUntil
and can instead probably just set playlist.excludeUntil = Infinity;
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added this to make sure we only exclude/clear buffer/switch playlists once in the event we get multiple output-restricted
events, which I have encountered in testing.
src/videojs-http-streaming.js
Outdated
if (excludedHDPlaylists.length) { | ||
videojs.log.warn( | ||
'DRM keystatus changed to "output-restricted." Removing the following HD playlists ' + | ||
'that will most likely fail to play and clearing already buffered HD segments. ' + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically, we're clearing a buffer which may contain more than just HD segments.
'that will most likely fail to play and clearing already buffered HD segments. ' + | |
'that will most likely fail to play and clearing the buffer. ' + |
src/videojs-http-streaming.js
Outdated
videojs.log.warn( | ||
'DRM keystatus changed to "output-restricted." Removing the following HD playlists ' + | ||
'that will most likely fail to play and clearing already buffered HD segments. ' + | ||
'Check for HDCP content.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This may not always be an issue for the stream provider, but can instead involve, for instance, the client not having the right hardware to play back HDCP content. We can add something like:
`This may be due to HDCP restrictions on the stream and the capabilities of the current device."
test/videojs-http-streaming.test.js
Outdated
}; | ||
|
||
const excludes = []; | ||
this.player.tech_.vhs.masterPlaylistController_.media = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.player.tech_.vhs.masterPlaylistController_.media = () => { | |
this.player.tech_.vhs.masterPlaylistController_.master = () => { |
…ideojs/http-streaming into fix-output-restricted-handling
Description
This change will improve handling of EME
'keystatuschange'
events of the type'output-restricted'
, which occurs when the client does not meet HDCP compliance. The existing implementation usesblacklistCurrentPlaylist()
to exclude a single playlist from ABR selection when such an event is encountered, but does not handle cases where there are multiple unplayable HD streams.Specific Changes proposed
I am proposing we do the following:
'output-restricted'
, we should assume that this is due to HDCP non-compliance and that all HD playlists will be unplayable.fastQualityChange_()
which will clear the buffer and switch to a playable SD stream.