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

Add robustness suggestions for Widevine #1008

Merged
merged 3 commits into from
Oct 3, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions demo/asset_section.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,8 @@ shakaDemo.load = function() {

shakaDemo.hashShouldChange_();

shakaDemo.updateRobustnessSuggestions_();

// Set a different poster for audio-only assets.
if (player.isAudioOnly()) {
shakaDemo.localVideo_.poster = shakaDemo.audioOnlyPoster_;
Expand Down
19 changes: 19 additions & 0 deletions demo/configuration_section.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,25 @@ shakaDemo.setupConfiguration_ = function() {
};


/** @private */
shakaDemo.updateRobustnessSuggestions_ = function() {
var drmInfo = shakaDemo.player_.drmInfo();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I appreciate the idea, but this won't work as you would expect.

drmInfo() returns info about the currently-loaded stream. Before you load anything, it returns null.

The robustness settings, however, have no immediate effect. They effect the next content you load.

So using the key system of the current content to decide what values to suggest for the next content is not going to work the way it should in all cases.

An alternative would be to detect what key systems are supported by the browser, and suggest all known robustness settings for all supported key systems. (Currently, the only key system with well-known values is Widevine, but we hope to see that change.)

var drmSettingsVideoRobustness =
document.getElementById('drmSettingsVideoRobustness');
var drmSettingsAudioRobustness =
document.getElementById('drmSettingsAudioRobustness');

// Suggest appropriate robustness values for Widevine.
if (drmInfo && drmInfo.keySystem === 'com.widevine.alpha') {
drmSettingsVideoRobustness.setAttribute('list', 'widevineRobustnessValues');
drmSettingsAudioRobustness.setAttribute('list', 'widevineRobustnessValues');
} else {
drmSettingsVideoRobustness.removeAttribute('list');
drmSettingsAudioRobustness.removeAttribute('list');
}
};


/** @private */
shakaDemo.onAutoplayChange_ = function() {
// Change the hash, to mirror this.
Expand Down
7 changes: 7 additions & 0 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,13 @@ <h1>Shaka Player <span id="version"></span></h1>
<label for="drmSettingsAudioRobustness">Audio Robustness:</label>
<input id="drmSettingsAudioRobustness" type="text" class="flex-grow">
</div>
<datalist id="widevineRobustnessValues">
<option value="SW_SECURE_CRYPTO">SW_SECURE_CRYPTO (Widevine)</option>
<option value="SW_SECURE_DECODE">SW_SECURE_DECODE (Widevine)</option>
<option value="HW_SECURE_CRYPTO">HW_SECURE_CRYPTO (Widevine)</option>
<option value="HW_SECURE_DECODE">HW_SECURE_DECODE (Widevine)</option>
<option value="HW_SECURE_ALL">HW_SECURE_ALL (Widevine)</option>
</datalist>
</details>

<details class="input">
Expand Down