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

[DRM] CMAF PlayReady play error occurs #5667

Closed
KimChris opened this issue Jul 17, 2023 · 3 comments
Closed

[DRM] CMAF PlayReady play error occurs #5667

KimChris opened this issue Jul 17, 2023 · 3 comments
Labels
answered DRM Question Verify Fixed An unreleased bug fix has been merged and should be verified before closing.

Comments

@KimChris
Copy link

What do you want to do with Hls.js?

i want play CMAF PlayReady DRM

But in the latest version of hls.js I get an error

Is there something wrong with my setup?

_drmSystems = {
"com.microsoft.playready": {
licenseUrl: "licenseUrl"
}
};

new hlsJS({
debug: true,
autoStartLoad: true,
maxMaxBufferLength: 30,
maxBufferLength: 30,
startLevel: _startLevel,
manifestLoadingRetryDelay: 1000,
startPosition: 0,
emeEnabled: true,
drmSystems: _drmSystems
});

What have you tried so far?

[log] > Debug logs enabled for "Hls instance"
hls.js:15617 [log] > stopLoad
hls.js:8485 [log] > [stream-controller]: Trigger BUFFER_RESET
hls.js:15558 [log] > attachMedia
hls.js:15607 [log] > startLoad(-1)
hls.js:3002 [log] > [subtitle-stream-controller]: STOPPED->IDLE
hls.js:3085 [log] > [buffer-controller]: Media source opened
hls.js:7197 [log] > [level-controller]: manifest loaded, 6 level(s) found, first bitrate: 4357463
hls.js:3174 [log] > 2 bufferCodec event(s) expected
hls.js:15607 [log] > startLoad(0)
hls.js:7536 [log] > [level-controller]: switching to level 1 from -1
hls.js:1514 [log] > [audio-track-controller]: Updating audio tracks, 1 track(s) found in "audio_0" group-id
hls.js:1540 [log] > [audio-track-controller]: Now switching to audio-track index 0
hls.js:3002 [log] > [audio-stream-controller]: STOPPED->IDLE
hls.js:3002 [log] > [audio-stream-controller]: IDLE->WAITING_TRACK
hls.js:1608 [log] > [audio-track-controller]: loading audio-track playlist for id: 0
hls.js:7445 [log] > [level-controller]: Attempt loading level index 1 with URL-id 0
hls.js:3002 [log] > [stream-controller]: STOPPED->IDLE
hls.js:1608 [log] > [audio-track-controller]: loading audio-track playlist for id: 0
hls.js:3002 [log] > [audio-stream-controller]: WAITING_TRACK->STOPPED
hls.js:3002 [log] > [audio-stream-controller]: STOPPED->WAITING_TRACK
hls.js:3002 [log] > [subtitle-stream-controller]: IDLE->STOPPED
hls.js:3002 [log] > [subtitle-stream-controller]: STOPPED->IDLE
hls.js:5460 [log] > [eme] Selecting key-system from session-keys com.apple.streamingkeydelivery, com.microsoft.playready, urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed
hls.js:4847 [log] > [eme] Requesting encrypted media "com.apple.fps" key-system access with config: [{"initDataTypes":["cenc","sinf"],"persistentState":"not-allowed","distinctiveIdentifier":"not-allowed","sessionTypes":["temporary"],"audioCapabilities":[{"contentType":"audio/mp4; codecs="mp4a.40.2"","robustness":"","encryptionScheme":null}],"videoCapabilities":[{"contentType":"video/mp4; codecs="avc1.64001E"","robustness":"","encryptionScheme":null}]}]
hls.js:4853 [log] > [eme] Failed to obtain access to key-system "com.apple.fps": NotSupportedError: Unsupported keySystem or supportedConfigurations.
hls.js:4847 [log] > [eme] Requesting encrypted media "com.microsoft.playready" key-system access with config: [{"initDataTypes":["cenc"],"persistentState":"not-allowed","distinctiveIdentifier":"not-allowed","sessionTypes":["temporary"],"audioCapabilities":[{"contentType":"audio/mp4; codecs="mp4a.40.2"","robustness":"","encryptionScheme":null}],"videoCapabilities":[{"contentType":"video/mp4; codecs="avc1.64001E"","robustness":"","encryptionScheme":null}]}]
hls.js:4856 [log] > [eme] Access for key-system "com.microsoft.playready" obtained
hls.js:4858 [log] > [eme] Create media-keys for "com.microsoft.playready"
hls.js:8536 [log] > [stream-controller]: Level 1 loaded [1,6], cc [0, 0] duration:59.165
hls.js:3627 [log] > [buffer-controller]: Updating Media Source duration to 59.165
hls.js:2383 [log] > [stream-controller]: Loading fragment initSegment cc: 0 of [1-6] level: 1, target: 0
hls.js:3002 [log] > [stream-controller]: IDLE->FRAG_LOADING
hls.js:1480 [log] > [audio-track-controller]: audioTrack 0 loaded [1-6]
hls.js:1062 [log] > [audio-stream-controller]: Track 0 loaded [1,6],duration:59.219
hls.js:3002 [log] > [audio-stream-controller]: WAITING_TRACK->IDLE
hls.js:2383 [log] > [audio-stream-controller]: Loading fragment initSegment cc: 0 of [1-6] track: 0, target: 0
hls.js:3002 [log] > [audio-stream-controller]: IDLE->FRAG_LOADING
hls.js:3002 [log] > [stream-controller]: FRAG_LOADING->IDLE
hls.js:2284 [log] > [stream-controller]: Buffered main sn: initSegment of level 1 (frag:[NaN-NaN] > buffer:)
hls.js:2326 [log] > [stream-controller]: Loading key for 1 of [1-6], level 1
hls.js:3002 [log] > [stream-controller]: IDLE->KEY_LOADING
hls.js:2383 [log] > [stream-controller]: Loading fragment 1 cc: 0 of [1-6] level: 1, target: 0
hls.js:3002 [log] > [stream-controller]: KEY_LOADING->FRAG_LOADING
hls.js:3002 [log] > [audio-stream-controller]: FRAG_LOADING->IDLE
hls.js:2284 [log] > [audio-stream-controller]: Buffered audio sn: initSegment of track 0 (frag:[NaN-NaN] > buffer:)
hls.js:2326 [log] > [audio-stream-controller]: Loading key for 1 of [1-6], track 0
hls.js:3002 [log] > [audio-stream-controller]: IDLE->KEY_LOADING
hls.js:2383 [log] > [audio-stream-controller]: Loading fragment 1 cc: 0 of [1-6] track: 0, target: 0
hls.js:3002 [log] > [audio-stream-controller]: KEY_LOADING->FRAG_LOADING
hls.js:4860 [log] > [eme] Media-keys created for "com.microsoft.playready"
hls.js:4953 [log] > [eme] Starting session for key (keyId: 54834d349804fce7c145d863c8568d49 format: "com.microsoft.playready" method: SAMPLE-AES uri: data:text/plain;base64,AAAC2HBzc2gAAAAAmgTweZhAQoarkuZb4IhflQAAAri4AgAAAQABAK4CPABXAFIATQBIAEUAQQBEAEUAUgAgAHgAbQBsAG4AcwA9ACIAaAB0AHQAcAA6AC8ALwBzAGMAaABlAG0AYQBzAC4AbQBpAGMAcgBvAHMAbwBmAHQALgBjAG8AbQAvAEQAUgBNAC8AMgAwADAANwAvADAAMwAvAFAAbABhAHkAUgBlAGEAZAB5AEgAZQBhAGQAZQByACIAIAB2AGUAcgBzAGkAbwBuAD0AIgA0AC4AMwAuADAALgAwACIAPgA8AEQAQQBUAEEAPgA8AFAAUgBPAFQARQBDAFQASQBOAEYATwA+ADwASwBJAEQAUwA+ADwASwBJAEQAIABBAEwARwBJAEQAPQAiAEEARQBTAEMAQgBDACIAIABWAEEATABVAEUAPQAiAE4ARQAyAEQAVgBBAFMAWQA1AC8AegBCAFIAZABoAGoAeQBGAGEATgBTAFEAPQA9ACIAPgA8AC8ASwBJAEQAPgA8AEsASQBEACAAQQBMAEcASQBEAD0AIgBBAEUAUwBDAEIAQwAiACAAVgBBAEwAVQBFAD0AIgA4AGUAMgBEADMATwBmADYARAAyADIANQAvAEcAbwBkAGYAaQBNAHMAWQBBAD0APQAiAD4APAAvAEsASQBEAD4APAAvAEsASQBEAFMAPgA8AC8AUABSAE8AVABFAEMAVABJAE4ARgBPAD4APABMAEEAXwBVAFIATAA+AGgAdAB0AHAAcwA6AC8ALwBsAGkAYwBlAG4AcwBlAC4AcABhAGwAbAB5AGMAbwBuAC4AYwBvAG0ALwByAGkALwBsAGkAYwBlAG4AcwBlAE0AYQBuAGEAZwBlAHIALgBkAG8APAAvAEwAQQBfAFUAUgBMAD4APAAvAEQAQQBUAEEAPgA8AC8AVwBSAE0ASABFAEEARABFAFIAPgA=)
hls.js:4960 [log] > [eme] Handle encrypted media sn: 1 main: 1 using key (keyId: 54834d349804fce7c145d863c8568d49 format: "com.microsoft.playready" method: SAMPLE-AES uri: data:text/plain;base64,AAAC2HBzc2gAAAAAmgTweZhAQoarkuZb4IhflQAAAri4AgAAAQABAK4CPABXAFIATQBIAEUAQQBEAEUAUgAgAHgAbQBsAG4AcwA9ACIAaAB0AHQAcAA6AC8ALwBzAGMAaABlAG0AYQBzAC4AbQBpAGMAcgBvAHMAbwBmAHQALgBjAG8AbQAvAEQAUgBNAC8AMgAwADAANwAvADAAMwAvAFAAbABhAHkAUgBlAGEAZAB5AEgAZQBhAGQAZQByACIAIAB2AGUAcgBzAGkAbwBuAD0AIgA0AC4AMwAuADAALgAwACIAPgA8AEQAQQBUAEEAPgA8AFAAUgBPAFQARQBDAFQASQBOAEYATwA+ADwASwBJAEQAUwA+ADwASwBJAEQAIABBAEwARwBJAEQAPQAiAEEARQBTAEMAQgBDACIAIABWAEEATABVAEUAPQAiAE4ARQAyAEQAVgBBAFMAWQA1AC8AegBCAFIAZABoAGoAeQBGAGEATgBTAFEAPQA9ACIAPgA8AC8ASwBJAEQAPgA8AEsASQBEACAAQQBMAEcASQBEAD0AIgBBAEUAUwBDAEIAQwAiACAAVgBBAEwAVQBFAD0AIgA4AGUAMgBEADMATwBmADYARAAyADIANQAvAEcAbwBkAGYAaQBNAHMAWQBBAD0APQAiAD4APAAvAEsASQBEAD4APAAvAEsASQBEAFMAPgA8AC8AUABSAE8AVABFAEMAVABJAE4ARgBPAD4APABMAEEAXwBVAFIATAA+AGgAdAB0AHAAcwA6AC8ALwBsAGkAYwBlAG4AcwBlAC4AcABhAGwAbAB5AGMAbwBuAC4AYwBvAG0ALwByAGkALwBsAGkAYwBlAG4AcwBlAE0AYQBuAGEAZwBlAHIALgBkAG8APAAvAEwAQQBfAFUAUgBMAD4APAAvAEQAQQBUAEEAPgA8AC8AVwBSAE0ASABFAEEARABFAFIAPgA=)
hls.js:5127 [log] > [eme] Setting media-keys for "com.microsoft.playready"
hls.js:5138 [log] > [eme] Media-keys set for "com.microsoft.playready"
hls.js:4883 [log] > [eme] Creating key-system session "com.microsoft.playready" keyId: 54834d349804fce7c145d863c8568d49
hls.js:5171 [log] > [eme] Generating key-session request for "playlist-key": 54834d349804fce7c145d863c8568d49 (init data type: cenc length: 760)
hls.js:5469 [log] > [eme] Remove licenses and keys and close session
hls.js:5481 [log] > [eme] Could not remove session: InvalidStateError: Failed to execute 'remove' on 'MediaKeySession': The session is not callable.

hls.js:4990 [error] > [eme] Error generating key-session request: NotSupportedError: Failed to execute 'generateRequest' on 'MediaKeySession': Failed to create MF PR CdmSession (2147797505)

hls.js:7348 [warn] > [level-controller]: keySystemNoSession: switch to 0

@KimChris KimChris added Needs Triage If there is a suspected stream issue, apply this label to triage if it is something we should fix. Question labels Jul 17, 2023
@robwalch
Copy link
Collaborator

Is there something wrong with my setup?

You are probably not processing the license challenge properly. See licenseXhrSetup and licenseResponseCallback documentation, and work with your DRM vendor to implement their required license request and response.

https://github.com/video-dev/hls.js/blob/v1.4.9/docs/API.md#licensexhrsetup

hls.js/src/config.ts

Lines 97 to 116 in d0e6702

export type EMEControllerConfig = {
licenseXhrSetup?: (
this: Hls,
xhr: XMLHttpRequest,
url: string,
keyContext: MediaKeySessionContext,
licenseChallenge: Uint8Array
) => void | Uint8Array | Promise<Uint8Array | void>;
licenseResponseCallback?: (
this: Hls,
xhr: XMLHttpRequest,
url: string,
keyContext: MediaKeySessionContext
) => ArrayBuffer;
emeEnabled: boolean;
widevineLicenseUrl?: string;
drmSystems: DRMSystemsConfiguration;
drmSystemOptions: DRMSystemOptions;
requestMediaKeySystemAccessFunc: MediaKeyFunc | null;
};

@robwalch robwalch added answered and removed Needs Triage If there is a suspected stream issue, apply this label to triage if it is something we should fix. labels Jul 17, 2023
@KimChris
Copy link
Author

Thank you for quick answer!

I set the licenseXhrSetup option but I get the same error

licenseXhrSetup function is not called

For reference, the cmaf dash format is played in the Chrome browser.

@robwalch
Copy link
Collaborator

robwalch commented Dec 1, 2023

This issue should be resolved with #5699 in v1.5. Please verify against v1.5.0-beta.2 or latest dev build.

@robwalch robwalch added the Verify Fixed An unreleased bug fix has been merged and should be verified before closing. label Dec 1, 2023
@robwalch robwalch added the DRM label Dec 11, 2023
@robwalch robwalch closed this as completed Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
answered DRM Question Verify Fixed An unreleased bug fix has been merged and should be verified before closing.
Projects
None yet
Development

No branches or pull requests

2 participants