Skip to content

Commit

Permalink
Fix/robustness warnings (#4549)
Browse files Browse the repository at this point in the history
* Set robustness level for Widevine check in Media Capabilities API to avoid warnings

* Fix IMA test
  • Loading branch information
dsilhavy committed Aug 16, 2024
1 parent d9454a1 commit 5791060
Show file tree
Hide file tree
Showing 7 changed files with 1,004 additions and 10 deletions.
3 changes: 2 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"MediaSource": true,
"WebKitMediaKeys": true,
"MSMediaKeys": true,
"MediaKeys": true
"MediaKeys": true,
"google": true
},
"parserOptions": {
"ecmaVersion": 2020,
Expand Down
9 changes: 9 additions & 0 deletions src/streaming/constants/ProtectionConstants.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,15 @@ export default {
LICENSE_RENEWAL: 'license-renewal',
LICENSE_RELEASE: 'license-release',
INDIVIDUALIZATION_REQUEST: 'individualization-request',
},
ROBUSTNESS_STRINGS: {
WIDEVINE: {
SW_SECURE_CRYPTO: 'SW_SECURE_CRYPTO',
SW_SECURE_DECODE: 'SW_SECURE_DECODE',
HW_SECURE_CRYPTO: 'HW_SECURE_CRYPTO',
HW_SECURE_DECODE: 'HW_SECURE_DECODE',
HW_SECURE_ALL: 'HW_SECURE_ALL'
}
}
}

Expand Down
9 changes: 7 additions & 2 deletions src/streaming/utils/Capabilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
*/
import FactoryMaker from '../../core/FactoryMaker.js';
import Constants from '../constants/Constants.js';
import ProtectionConstants from '../constants/ProtectionConstants.js';

export function supportsMediaSource() {
let hasManagedMediaSource = ('ManagedMediaSource' in window)
Expand Down Expand Up @@ -165,7 +166,7 @@ function Capabilities() {
}

const genericMediaCapabilitiesConfiguration = _getGenericMediaCapabilitiesConfig(inputConfig, type);
const configurationsToTest = _enhanceGenericConfigurationWithKeySystemConfiguration(genericMediaCapabilitiesConfiguration, inputConfig)
const configurationsToTest = _enhanceGenericConfigurationWithKeySystemConfiguration(genericMediaCapabilitiesConfiguration, inputConfig, type)
const promises = configurationsToTest.map((configuration) => {
return navigator.mediaCapabilities.decodingInfo(configuration)
})
Expand Down Expand Up @@ -229,7 +230,7 @@ function Capabilities() {
return configuration
}

function _enhanceGenericConfigurationWithKeySystemConfiguration(genericMediaCapabilitiesConfiguration, inputConfig) {
function _enhanceGenericConfigurationWithKeySystemConfiguration(genericMediaCapabilitiesConfiguration, inputConfig, type) {
if (!inputConfig || !inputConfig.keySystemsMetadata || inputConfig.keySystemsMetadata.length === 0) {
return [genericMediaCapabilitiesConfiguration];
}
Expand All @@ -241,6 +242,10 @@ function Capabilities() {
if (keySystemMetadata.ks.systemString) {
curr.keySystemConfiguration.keySystem = keySystemMetadata.ks.systemString;
}
if (keySystemMetadata.ks.systemString === ProtectionConstants.WIDEVINE_KEYSTEM_STRING) {
curr.keySystemConfiguration[type] = { robustness: ProtectionConstants.ROBUSTNESS_STRINGS.WIDEVINE.SW_SECURE_CRYPTO };

}
}
return curr
})
Expand Down
7 changes: 3 additions & 4 deletions test/functional/adapter/GoogleAdManagerAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ try {
VAST_EVENTS_TO_VERIFY[google.ima.dai.api.StreamEvent.Type.COMPLETE] = {
position: 4
};
}
catch(e) {
} catch (e) {
console.log(e);
}

Expand Down Expand Up @@ -89,13 +88,13 @@ class GoogleAdManagerAdapter {
const data = event.event.messageData;
const pts = event.event.calculatedPresentationTime;
if ((data instanceof Uint8Array) && data.byteLength > 0) {
console.log(`Called streamManager.processMetadata using EMSG event at playback time ${this.playerAdapter.getCurrentTime()}`)
//console.log(`Called streamManager.processMetadata using EMSG event at playback time ${this.playerAdapter.getCurrentTime()}`)
this.streamManager.processMetadata('ID3', data, pts);
}
}

requestStream() {
return new Promise((resolve, reject) => {
return new Promise((resolve) => {
const streamRequest = new google.ima.dai.api.PodStreamRequest();
streamRequest.networkCode = NETWORK_CODE;
streamRequest.customAssetKey = CUSTOM_ASSET_KEY;
Expand Down
4 changes: 2 additions & 2 deletions test/functional/config/karma.functional.conf.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ module.exports = function (config) {
// list of files / patterns to load in the browser
// https://github.com/webpack-contrib/karma-webpack#alternative-usage
files: [
{ pattern: 'https://imasdk.googleapis.com/js/sdkloader/ima3_dai.js', watched: false, nocache: true },
{ pattern: 'test/functional/lib/ima3_dai.js', watched: false, nocache: true },
{ pattern: 'dist/dash.all.debug.js', watched: false, nocache: true },
{ pattern: 'dist/dash.mss.min.js', watched: false, nocache: true },
{ pattern: 'test/functional/content/**/*.mpd', watched: false, included: false, served: true }
Expand Down Expand Up @@ -110,7 +110,7 @@ module.exports = function (config) {
client: {
useIframe: false,
mocha: {
timeout: 90000
timeout: 100000
},
testvectors
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"all"
],
"excluded": [
"vendor/google-ad-manager-emsg"
]
},
"testvectors": [
Expand Down
Loading

0 comments on commit 5791060

Please sign in to comment.