From c1a81dc9dec215ce073f94b12ff6b5e12721ec5a Mon Sep 17 00:00:00 2001 From: Francois Beaufort Date: Wed, 6 Sep 2017 10:54:41 +0200 Subject: [PATCH 1/3] Add robustness suggestions for Widevine --- demo/asset_section.js | 2 ++ demo/configuration_section.js | 19 +++++++++++++++++++ demo/index.html | 7 +++++++ 3 files changed, 28 insertions(+) diff --git a/demo/asset_section.js b/demo/asset_section.js index 30545aedd4..ba481893d1 100644 --- a/demo/asset_section.js +++ b/demo/asset_section.js @@ -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_; diff --git a/demo/configuration_section.js b/demo/configuration_section.js index 3c84494e3a..11b2f8e1cf 100644 --- a/demo/configuration_section.js +++ b/demo/configuration_section.js @@ -54,6 +54,25 @@ shakaDemo.setupConfiguration_ = function() { }; +/** @private */ +shakaDemo.updateRobustnessSuggestions_ = function() { + var drmInfo = shakaDemo.player_.drmInfo(); + 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. diff --git a/demo/index.html b/demo/index.html index fd54de3358..e1a75e15e6 100644 --- a/demo/index.html +++ b/demo/index.html @@ -178,6 +178,13 @@

Shaka Player

+ + + + + + +
From feb1d87119ab0ea0a3a951e08ab4f1b6e620fe0a Mon Sep 17 00:00:00 2001 From: Francois Beaufort Date: Thu, 7 Sep 2017 09:10:22 +0200 Subject: [PATCH 2/3] Address @joeyparrish feedback --- demo/asset_section.js | 11 +++++++++-- demo/configuration_section.js | 19 ------------------- demo/index.html | 18 +++++++++--------- 3 files changed, 18 insertions(+), 30 deletions(-) diff --git a/demo/asset_section.js b/demo/asset_section.js index ba481893d1..625920816a 100644 --- a/demo/asset_section.js +++ b/demo/asset_section.js @@ -37,6 +37,7 @@ shakaDemo.setupAssets_ = function() { /** @type {!Object.} */ var groups = {}; var first = null; + var robustnessSuggestions = document.getElementById('robustnessSuggestions'); shakaAssets.testAssets.forEach(function(asset) { if (asset.disabled) return; @@ -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) { + robustnessSuggestions.childNodes.forEach(function(suggestion) { + if (suggestion.nodeName == 'OPTION' && + keySystem === suggestion.dataset.keysystem) { + suggestion.disabled = true; + } + }); + }); } var mimeTypes = []; @@ -233,8 +242,6 @@ shakaDemo.load = function() { shakaDemo.hashShouldChange_(); - shakaDemo.updateRobustnessSuggestions_(); - // Set a different poster for audio-only assets. if (player.isAudioOnly()) { shakaDemo.localVideo_.poster = shakaDemo.audioOnlyPoster_; diff --git a/demo/configuration_section.js b/demo/configuration_section.js index 11b2f8e1cf..3c84494e3a 100644 --- a/demo/configuration_section.js +++ b/demo/configuration_section.js @@ -54,25 +54,6 @@ shakaDemo.setupConfiguration_ = function() { }; -/** @private */ -shakaDemo.updateRobustnessSuggestions_ = function() { - var drmInfo = shakaDemo.player_.drmInfo(); - 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. diff --git a/demo/index.html b/demo/index.html index e1a75e15e6..6fd2ce56a8 100644 --- a/demo/index.html +++ b/demo/index.html @@ -172,18 +172,18 @@

Shaka Player

- +
- -
- - - - - - + + + + + + + +
From c8b5c0707a7679bfa4b64848675288eadfccef67 Mon Sep 17 00:00:00 2001 From: Francois Beaufort Date: Thu, 21 Sep 2017 11:43:27 +0200 Subject: [PATCH 3/3] Detect browser support --- demo/asset_section.js | 9 --------- demo/configuration_section.js | 13 +++++++++++++ demo/index.html | 8 +------- 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/demo/asset_section.js b/demo/asset_section.js index 625920816a..30545aedd4 100644 --- a/demo/asset_section.js +++ b/demo/asset_section.js @@ -37,7 +37,6 @@ shakaDemo.setupAssets_ = function() { /** @type {!Object.} */ var groups = {}; var first = null; - var robustnessSuggestions = document.getElementById('robustnessSuggestions'); shakaAssets.testAssets.forEach(function(asset) { if (asset.disabled) return; @@ -58,14 +57,6 @@ 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) { - robustnessSuggestions.childNodes.forEach(function(suggestion) { - if (suggestion.nodeName == 'OPTION' && - keySystem === suggestion.dataset.keysystem) { - suggestion.disabled = true; - } - }); - }); } var mimeTypes = []; diff --git a/demo/configuration_section.js b/demo/configuration_section.js index 3c84494e3a..f61ed62058 100644 --- a/demo/configuration_section.js +++ b/demo/configuration_section.js @@ -51,6 +51,19 @@ shakaDemo.setupConfiguration_ = function() { 'input', shakaDemo.onDrmSettingsChange_); document.getElementById('drmSettingsAudioRobustness').addEventListener( 'input', shakaDemo.onDrmSettingsChange_); + + var robustnessSuggestions = document.getElementById('robustnessSuggestions'); + if (shakaDemo.support_.drm['com.widevine.alpha']) { + var widevineSuggestions = ['SW_SECURE_CRYPTO', 'SW_SECURE_DECODE', + 'HW_SECURE_CRYPTO', 'HW_SECURE_DECODE', 'HW_SECURE_ALL']; + // Add Widevine robustness suggestions if it is supported. + widevineSuggestions.forEach(function(suggestion) { + var option = document.createElement('option'); + option.value = suggestion; + option.textContent = 'Widevine'; + robustnessSuggestions.appendChild(option); + }); + } }; diff --git a/demo/index.html b/demo/index.html index 6fd2ce56a8..73268a1cb7 100644 --- a/demo/index.html +++ b/demo/index.html @@ -178,13 +178,7 @@

Shaka Player

- - - - - - - +