@@ -41,15 +41,22 @@ import ProtectionKeyController from '../controllers/ProtectionKeyController.js';
4141import NeedKey from '../vo/NeedKey.js' ;
4242import ProtectionErrors from '../errors/ProtectionErrors.js' ;
4343import DashJSError from '../../vo/DashJSError.js' ;
44- import KeyMessage from '../vo/KeyMessage.js' ;
4544import KeySystemAccess from '../vo/KeySystemAccess.js' ;
46- import ProtectionConstants from '../../constants/ProtectionConstants .js' ;
45+ import KeyMessage from '../vo/KeyMessage .js' ;
4746import FactoryMaker from '../../../core/FactoryMaker.js' ;
4847
48+ // imports from common-media-library
49+ import { PLAYREADY_KEY_SYSTEM } from '@svta/common-media-library/drm/common/const/PLAYREADY_KEY_SYSTEM.js' ;
50+ import { PLAYREADY_RECOMMENDATION_KEY_SYSTEM } from '@svta/common-media-library/drm/common/const/PLAYREADY_RECOMMENDATION_KEY_SYSTEM.js' ;
51+ import { WIDEVINE_KEY_SYSTEM } from '@svta/common-media-library/drm/common/const/WIDEVINE_KEY_SYSTEM.js' ;
52+ import { CLEAR_KEY_SYSTEM } from '@svta/common-media-library/drm/common/const/CLEAR_KEY_SYSTEM.js' ;
53+ import { INITIALIZATION_DATA_TYPE } from '@svta/common-media-library/drm/common/const/INITIALIZATION_DATA_TYPE.js' ;
54+ import { MEDIA_KEY_STATUSES } from '@svta/common-media-library/drm/common/const/MEDIA_KEY_STATUSES.js' ;
55+
4956const SYSTEM_STRING_PRIORITY = { } ;
50- SYSTEM_STRING_PRIORITY [ ProtectionConstants . PLAYREADY_KEYSTEM_STRING ] = [ ProtectionConstants . PLAYREADY_KEYSTEM_STRING , ProtectionConstants . PLAYREADY_RECOMMENDATION_KEYSTEM_STRING ] ;
51- SYSTEM_STRING_PRIORITY [ ProtectionConstants . WIDEVINE_KEYSTEM_STRING ] = [ ProtectionConstants . WIDEVINE_KEYSTEM_STRING ] ;
52- SYSTEM_STRING_PRIORITY [ ProtectionConstants . CLEARKEY_KEYSTEM_STRING ] = [ ProtectionConstants . CLEARKEY_KEYSTEM_STRING ] ;
57+ SYSTEM_STRING_PRIORITY [ PLAYREADY_KEY_SYSTEM ] = [ PLAYREADY_KEY_SYSTEM , PLAYREADY_RECOMMENDATION_KEY_SYSTEM ] ;
58+ SYSTEM_STRING_PRIORITY [ WIDEVINE_KEY_SYSTEM ] = [ WIDEVINE_KEY_SYSTEM ] ;
59+ SYSTEM_STRING_PRIORITY [ CLEAR_KEY_SYSTEM ] = [ CLEAR_KEY_SYSTEM ] ;
5360
5461function DefaultProtectionModel ( config ) {
5562
@@ -310,7 +317,7 @@ function DefaultProtectionModel(config) {
310317 const sessionToken = _createSessionToken ( mediaKeySession , keySystemMetadata ) ;
311318
312319 // The "keyids" type is used for Clearkey when keys are provided directly in the protection data and a request to a license server is not needed
313- const dataType = keySystem . systemString === ProtectionConstants . CLEARKEY_KEYSTEM_STRING && ( keySystemMetadata . initData || ( keySystemMetadata . protData && keySystemMetadata . protData . clearkeys ) ) ? ProtectionConstants . INITIALIZATION_DATA_TYPE_KEYIDS : ProtectionConstants . INITIALIZATION_DATA_TYPE_CENC ;
320+ const dataType = keySystem . systemString === CLEAR_KEY_SYSTEM && ( keySystemMetadata . initData || ( keySystemMetadata . protData && keySystemMetadata . protData . clearkeys ) ) ? INITIALIZATION_DATA_TYPE . KEYIDS : INITIALIZATION_DATA_TYPE . CENC ;
314321
315322 mediaKeySession . generateRequest ( dataType , keySystemMetadata . initData )
316323 . then ( function ( ) {
@@ -520,7 +527,7 @@ function DefaultProtectionModel(config) {
520527 let usable = false ;
521528 session . keyStatuses . forEach ( function ( ) {
522529 let keyStatus = _parseKeyStatus ( arguments ) ;
523- if ( keyStatus . status === ProtectionConstants . MEDIA_KEY_STATUSES . USABLE ) {
530+ if ( keyStatus . status === MEDIA_KEY_STATUSES . USABLE ) {
524531 usable = true ;
525532 }
526533 } ) ;
0 commit comments