1414 * limitations under the License.
1515 */
1616
17- import { canRelyOnRequestMediaKeySystemAccess } from "../../compat/can_rely_on_request_media_key_system_access" ;
17+ import {
18+ canRelyOnRequestMediaKeySystemAccess ,
19+ PLAY_READY_HEADER_EXAMPLE ,
20+ } from "../../compat/can_rely_on_request_media_key_system_access" ;
1821import type { ICustomMediaKeySystemAccess } from "../../compat/eme" ;
1922import eme from "../../compat/eme" ;
2023import shouldRenewMediaKeySystemAccess from "../../compat/should_renew_media_key_system_access" ;
@@ -378,7 +381,7 @@ export default function getMediaKeySystemAccess(
378381 ) ;
379382
380383 try {
381- const keySystemAccess = await testOneKeySystem ( keyType , keySystemConfigurations ) ;
384+ const keySystemAccess = await testKeySystem ( keyType , keySystemConfigurations ) ;
382385 log . info ( "DRM: Found compatible keysystem" , keyType , index + 1 ) ;
383386 return {
384387 type : "create-media-key-system-access" as const ,
@@ -403,7 +406,7 @@ export default function getMediaKeySystemAccess(
403406 * @param {Array.<MediaKeySystemMediaCapability> } keySystemConfigurations - Configurations for this keySystem
404407 * @returns Promise resolving with the MediaKeySystemAccess. Rejects if unsupported.
405408 */
406- export async function testOneKeySystem (
409+ export async function testKeySystem (
407410 keyType : string ,
408411 keySystemConfigurations : MediaKeySystemConfiguration [ ] ,
409412) {
@@ -416,10 +419,7 @@ export async function testOneKeySystem(
416419 try {
417420 const mediaKeys = await keySystemAccess . createMediaKeys ( ) ;
418421 const session = mediaKeys . createSession ( ) ;
419- // this is just and an example initData to test if the CDM is capable of generating a request
420- const playReadyHeader =
421- '<WRMHEADER xmlns="http://schemas.microsoft.com/DRM/2007/03/PlayReadyHeader" version="4.0.0.0"><DATA><PROTECTINFO><KEYLEN>16</KEYLEN><ALGID>AESCTR</ALGID></PROTECTINFO><KID>ckB07BNLskeUq0qd83fTbA==</KID><LA_URL>http://drm.canal-plus.com/</LA_URL><LUI_URL>http://drm.canal-plus.com/</LUI_URL><DS_ID>yYIPDBca1kmMfL60IsfgAQ==</DS_ID><CUSTOMATTRIBUTES xmlns=""><encryptionref>312_4024_2018127108</encryptionref></CUSTOMATTRIBUTES><CHECKSUM>U/tsUYRgMzw=</CHECKSUM></DATA></WRMHEADER>' ;
422- const initData = generatePlayReadyInitData ( playReadyHeader ) ;
422+ const initData = generatePlayReadyInitData ( PLAY_READY_HEADER_EXAMPLE ) ;
423423 await session . generateRequest ( "cenc" , initData ) ;
424424 } catch ( err ) {
425425 log . debug ( "DRM: KeySystemAccess was granted but it is not usable" ) ;
0 commit comments