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 2 commits
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
9 changes: 9 additions & 0 deletions demo/asset_section.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ shakaDemo.setupAssets_ = function() {
/** @type {!Object.<string, !HTMLOptGroupElement>} */
var groups = {};
var first = null;
var robustnessSuggestions = document.getElementById('robustnessSuggestions');
shakaAssets.testAssets.forEach(function(asset) {
if (asset.disabled) return;

Expand All @@ -57,6 +58,14 @@ shakaDemo.setupAssets_ = function() {
if (asset.drm.length && !asset.drm.some(
function(keySystem) { return shakaDemo.support_.drm[keySystem]; })) {
option.disabled = true;
asset.drm.forEach(function(keySystem) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Joey's suggestion was to use the drm probe to detect browser support. asset.drm is the key systems available in the asset. You can use shakaDemo.support_.drm[keySystem] to detect if it is supported on the browser.

Copy link
Member

Choose a reason for hiding this comment

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

Correct. We are less interested in what key systems the selected asset uses. If the "custom" field is used, we don't know. But if the browser supports Widevine, it is reasonable to suggest Widevine-specific values here regardless of what asset is selected.

robustnessSuggestions.childNodes.forEach(function(suggestion) {
if (suggestion.nodeName == 'OPTION' &&
keySystem === suggestion.dataset.keysystem) {
suggestion.disabled = true;
}
});
});
}

var mimeTypes = [];
Expand Down
13 changes: 10 additions & 3 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,19 @@ <h1>Shaka Player <span id="version"></span></h1>
</div>
<div>
<label for="drmSettingsVideoRobustness">Video Robustness:</label>
<input id="drmSettingsVideoRobustness" type="text" class="flex-grow">
<input id="drmSettingsVideoRobustness" type="text" class="flex-grow" list="robustnessSuggestions">
</div>
<div>
<label for="drmSettingsAudioRobustness">Audio Robustness:</label>
<input id="drmSettingsAudioRobustness" type="text" class="flex-grow">
</div>
<input id="drmSettingsAudioRobustness" type="text" class="flex-grow" list="robustnessSuggestions">
</div>
<datalist id="robustnessSuggestions">
Copy link
Contributor

Choose a reason for hiding this comment

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

Even though I would like to use this, caniuse says it is not well supported in all the browsers we support. You'll probably need to do this in JavaScript.

Copy link
Member

Choose a reason for hiding this comment

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

It will probably be fine.

The only browser with no support on that list is Safari, at which point Safari behaves the same as it did before.

Partial support on Firefox refers to text fields only, which works here.

Partial support on IE/Edge is a little more concerning, since it seems that some events may not fire. But if we don't need those events, it may still work. (I don't think we need change events on these fields.)

<option data-keysystem="com.widevine.alpha" value="SW_SECURE_CRYPTO">Widevine</option>
<option data-keysystem="com.widevine.alpha" value="SW_SECURE_DECODE">Widevine</option>
<option data-keysystem="com.widevine.alpha" value="HW_SECURE_CRYPTO">Widevine</option>
<option data-keysystem="com.widevine.alpha" value="HW_SECURE_DECODE">Widevine</option>
<option data-keysystem="com.widevine.alpha" value="HW_SECURE_ALL">Widevine</option>
</datalist>
</details>

<details class="input">
Expand Down