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

keySystemSessionUpdateFailed error #6874

Open
momyuke opened this issue Nov 28, 2024 · 11 comments
Open

keySystemSessionUpdateFailed error #6874

momyuke opened this issue Nov 28, 2024 · 11 comments

Comments

@momyuke
Copy link

momyuke commented Nov 28, 2024

What do you want to do with Hls.js?

Hello, i want to play the FPS content using hls.js but facing the issue like this

[Log] [log] > – "Debug logs enabled for \"Hls instance\" in hls.js version 1.5.17" (hls__js.js, line 342)
[Log] [log] > – "attachMedia" (hls__js.js, line 25050)
[Log] [log] > – "[buffer-controller]" – "created media source: ManagedMediaSource" (hls__js.js, line 16321)
[Log] [log] > – "[buffer-controller]" – "Media source opened" (hls__js.js, line 16207)
[Log] [log] > – "stopLoad" (hls__js.js, line 25103)
[Log] [log] > – "loadSource:https://05bce4580d95b32a.mediapackage.ap-southeast-1.amazonaws.com/out/v1/fd71e74c646b48b2be5d4228c20338ea/cloud_drm_cmaf_apple/i…" (hls__js.js, line 25076)
"loadSource:https://05bce4580d95b32a.mediapackage.ap-southeast-1.amazonaws.com/out/v1/fd71e74c646b48b2be5d4228c20338ea/cloud_drm_cmaf_apple/index.m3u8"
[Log] [log] > – "[stream-controller]:" – "Trigger BUFFER_RESET" (hls__js.js, line 24195)
[Log] [log] > – "[level-controller]:" – "manifest loaded, 1 level(s) found, first bitrate: 7499360" (hls__js.js, line 23010)
[Log] [log] > – "setting initial bwe to 5000000" (hls__js.js, line 6163)
[Log] [log] > – "[buffer-controller]" – "2 bufferCodec event(s) expected" (hls__js.js, line 16313)
[Log] [log] > – "startLoad(-1)" (hls__js.js, line 25093)
[Log] [log] > – "[level-controller]:" – "Switching to level 0 (1080p SDR avc1,mp4a @7499360) from level -1" (hls__js.js, line 23078)
[Log] [log] > – "[audio-track-controller]:" – "Updating audio tracks, 1 track(s) found in group(s): audio_0" (hls__js.js, line 15135)
[Log] [log] > – "[audio-track-controller]:" – "Switching to audio-track 0 \"und\" lang:und group:audio_0 channels:2" (hls__js.js, line 15228)
[Log] [log] > – "[audio-stream-controller]:" – "Reset loading state" (hls__js.js, line 9075)
[Log] [log] > – "[audio-stream-controller]:" – "STOPPED->IDLE" (hls__js.js, line 9177)
[Log] [log] > – "[audio-stream-controller]:" – "IDLE->WAITING_TRACK" (hls__js.js, line 9177)
[Log] [log] > – "[level-controller]:" – "Loading level index 0 with https://05bce4580d95b32a.mediapackage.ap-southeast-1.amazonaws.com/out/v1/fd71e74c646b48b2be5d4228c20338ea/cloud_…" (hls__js.js, line 23205)
"Loading level index 0 with https://05bce4580d95b32a.mediapackage.ap-southeast-1.amazonaws.com/out/v1/fd71e74c646b48b2be5d4228c20338ea/cloud_drm_cmaf_apple/index_1.m3u8"
[Log] [log] > – "[stream-controller]:" – "STOPPED->IDLE" (hls__js.js, line 9177)
[Log] [log] > – "[audio-track-controller]:" – "loading audio-track playlist 0 \"und\" lang:und group:audio_0" (hls__js.js, line 15300)
[Log] [log] > – "[audio-stream-controller]:" – "WAITING_TRACK->STOPPED" (hls__js.js, line 9177)
[Log] [log] > – "[audio-stream-controller]:" – "STOPPED->WAITING_TRACK" (hls__js.js, line 9177)
[Log] [log] > – "[subtitle-stream-controller]:" – "STOPPED->IDLE" (hls__js.js, line 9177)
[Log] [log] > – "[eme]" – "Selecting key-system from session-keys com.apple.streamingkeydelivery" (hls__js.js, line 20757)
[Log] [log] > – "[eme]" – "Requesting encrypted media \"com.apple.fps\" key-system access with config…" (hls__js.js, line 20097)
"Requesting encrypted media \"com.apple.fps\" key-system access with config: [{\"initDataTypes\":[\"cenc\",\"sinf\"],\"persistentState\":\"optional\",\"distinctiveIdentifier\":\"optional\",\"sessionTypes\":[\"temporary\"],\"audioCapabilities\":[{\"contentType\":\"audio/mp4; codecs=\\\"mp4a.40.2\\\"\",\"robustness\":\"\",\"encryptionScheme\":null}],\"videoCapabilities\":[{\"contentType\":\"video/mp4; codecs=\\\"avc1.4D4028\\\"\",\"robustness\":\"\",\"encryptionScheme\":null}]}]"
[Log] [log] > – "[eme]" – "Access for key-system \"com.apple.fps\" obtained" (hls__js.js, line 20106)
[Log] [log] > – "[eme]" – "Fetching server certificate for \"com.apple.fps\"" (hls__js.js, line 20508)
[Log] [log] > – "[eme]" – "Create media-keys for \"com.apple.fps\"" (hls__js.js, line 20108)
[Log] [log] > – "[eme]" – "Media-keys created for \"com.apple.fps\"" (hls__js.js, line 20110)
[Log] [log] > – "[level-controller]:" – "reload live playlist 0 in 2852 ms" (hls__js.js, line 5497)
[Log] [log] > – "[stream-controller]:" – "Level 0 loaded [6645,6664][part-6664--1], cc [10, 10] duration:60.06" (hls__js.js, line 24244)
[Log] [log] > – "[stream-controller]:" – "Live playlist sliding: 0.00 start-sn: na->6645 prev-sn: na fragments: 20" (hls__js.js, line 8924)
[Log] [log] > – "[buffer-controller]" – "Updating Media Source duration to 60.060" (hls__js.js, line 16823)
[Log] [log] > – "[stream-controller]:" – "Loading fragment initSegment cc: 0 of [6645-6664] level: 0, target: 0" (hls__js.js, line 8487)
[Log] [log] > – "[stream-controller]:" – "IDLE->FRAG_LOADING" (hls__js.js, line 9177)
[Log] [log] > – "[audio-track-controller]:" – "Audio track 0 \"und\" lang:und group:audio_0 loaded [6645-6664]" (hls__js.js, line 15083)
[Log] [log] > – "[audio-track-controller]:" – "reload live playlist 0 in 2848 ms" (hls__js.js, line 5497)
[Log] [log] > – "[audio-stream-controller]:" – "Audio track 0 loaded [6645,6664][part-6664--1],duration:60.05500000000002" (hls__js.js, line 14662)
[Log] [log] > – "[audio-stream-controller]:" – "Live playlist sliding: 0.00 start-sn: na->6645 prev-sn: na fragments: 20" (hls__js.js, line 8924)
[Log] [log] > – "[audio-stream-controller]:" – "WAITING_TRACK->IDLE" (hls__js.js, line 9177)
[Log] [log] > – "[audio-stream-controller]:" – "Loading fragment initSegment cc: 0 of [6645-6664] track: 0, target: 0" (hls__js.js, line 8487)
[Log] [log] > – "[audio-stream-controller]:" – "IDLE->FRAG_LOADING" (hls__js.js, line 9177)
[Log] [log] > – "[stream-controller]:" – "FRAG_LOADING->IDLE" (hls__js.js, line 9177)
[Log] [log] > – "[stream-controller]:" – "Loading key for 6662 of [6645-6664], level 0" (hls__js.js, line 8428)
[Log] [log] > – "[stream-controller]:" – "IDLE->KEY_LOADING" (hls__js.js, line 9177)
[Log] [log] > – "[eme]" – "Starting session for key (keyId: 00000000000000000000000000000000 format: \"com.apple.streamingkeydelivery\" method: SAMPLE-AES uri…" (hls__js.js, line 20199)
"Starting session for key (keyId: 00000000000000000000000000000000 format: \"com.apple.streamingkeydelivery\" method: SAMPLE-AES uri: skd://drm-demo-3.la.drm.cloud/acquire-license/fairplay?brandGuid=${brandGuid}&KID=c7b00df9-b14f-4e08-a986-63289bba7c89&IV=ca177443b63ad9823fa0460b6e384d7d)"
[Log] [log] > – "[stream-controller]:" – "Loading fragment 6662 cc: 10 of [6645-6664] level: 0, target: 51.073" (hls__js.js, line 8487)
[Log] [log] > – "[stream-controller]:" – "KEY_LOADING->FRAG_LOADING" (hls__js.js, line 9177)
[Log] [log] > – "[audio-stream-controller]:" – "FRAG_LOADING->IDLE" (hls__js.js, line 9177)
[Log] [log] > – "[audio-stream-controller]:" – "Waiting for video PTS in continuity counter 10 of live stream before loading audio fragment 6662 of level 0" (hls__js.js, line 14982)
[Log] [log] > – "[audio-stream-controller]:" – "IDLE->WAITING_INIT_PTS" (hls__js.js, line 9177)
[Log] [log] > – "[audio-stream-controller]:" – "WAITING_INIT_PTS->IDLE" (hls__js.js, line 9177)
[Log] [log] > – "[audio-stream-controller]:" – "Waiting for video PTS in continuity counter 10 of live stream before loading audio fragment 6662 of level 0" (hls__js.js, line 14982)
[Log] [log] > – "[audio-stream-controller]:" – "IDLE->WAITING_INIT_PTS" (hls__js.js, line 9177)
[Log] [log] > – "[audio-stream-controller]:" – "WAITING_INIT_PTS->IDLE" (hls__js.js, line 9177)
[Log] [log] > – "[audio-stream-controller]:" – "Waiting for video PTS in continuity counter 10 of live stream before loading audio fragment 6662 of level 0" (hls__js.js, line 14982)
[Log] [log] > – "[audio-stream-controller]:" – "IDLE->WAITING_INIT_PTS" (hls__js.js, line 9177)
[Log] [log] > – "[audio-stream-controller]:" – "WAITING_INIT_PTS->IDLE" (hls__js.js, line 9177)
[Log] [log] > – "[eme]" – "setServerCertificate success (1308) on \"com.apple.fps\"" (hls__js.js, line 20560)
[Log] [log] > – "[eme]" – "Handle encrypted media sn: 6662 main: 0 using key (keyId: 00000000000000000000000000000000 format: \"com.apple.streamingkeydelivery\" method…" (hls__js.js, line 20207)
"Handle encrypted media sn: 6662 main: 0 using key (keyId: 00000000000000000000000000000000 format: \"com.apple.streamingkeydelivery\" method: SAMPLE-AES uri: skd://drm-demo-3.la.drm.cloud/acquire-license/fairplay?brandGuid=${brandGuid}&KID=c7b00df9-b14f-4e08-a986-63289bba7c89&IV=ca177443b63ad9823fa0460b6e384d7d)"
[Log] [log] > – "[eme]" – "Setting media-keys for \"com.apple.fps\"" (hls__js.js, line 20370)
[Log] [log] > – "[eme]" – "Media-keys set for \"com.apple.fps\"" (hls__js.js, line 20379)
[Log] [log] > – "[eme]" – "Creating key-system session \"com.apple.fps\" keyId: 00000000000000000000000000000000" (hls__js.js, line 20131)
[Log] [log] > – "[eme]" – "Skipping key-session request for \"playlist-key\" (no initData)" (hls__js.js, line 20404)
[Log] [log] > – "[transmuxer-interface, main]: Starting new transmux session for sn: 6662 p: -1 level: 0 id: 1↵        discontinuity: true↵      …" (hls__js.js, line 14137)
"[transmuxer-interface, main]: Starting new transmux session for sn: 6662 p: -1 level: 0 id: 1
        discontinuity: true
        trackSwitch: true
        contiguous: false
        accurateTimeOffset: false
        timeOffset: 51.051
        initSegmentChange: true"
[Log] [log] > – "[stream-controller]:" – "FRAG_LOADING->PARSING" (hls__js.js, line 9177)
[Log] [log] > – "[stream-controller]:" – "Init video buffer, container:video/mp4, codecs[level/parsed]=[avc1.4D4028/avc1.4D4028]" (hls__js.js, line 24735)
[Log] [log] > – "[buffer-controller]" – "1 bufferCodec event(s) expected video" (hls__js.js, line 16460)
[Log] [log] > – "[audio-stream-controller]:" – "InitPTS for cc: 10 found from main: 19955.528000000002" (hls__js.js, line 14376)
[Log] [log] > – "[stream-controller]:" – "Loaded fragment 6662 of level 0" (hls__js.js, line 8235)
[Log] [log] > – "[transmuxer.ts]: Flushed fragment 6662 of level 0" (hls__js.js, line 13646)
[Log] [log] > – "[stream-controller]:" – "PARSING->PARSED" (hls__js.js, line 9177)
[Log] [log] > – "[audio-stream-controller]:" – "Loading key for 6662 of [6645-6664], track 0" (hls__js.js, line 8428)
[Log] [log] > – "[audio-stream-controller]:" – "IDLE->KEY_LOADING" (hls__js.js, line 9177)
[Log] [log] > – "[eme]" – "Starting session for key (keyId: 00000000000000000000000000000001 format: \"com.apple.streamingkeydelivery\" method: SAMPLE-AES uri…" (hls__js.js, line 20199)
"Starting session for key (keyId: 00000000000000000000000000000001 format: \"com.apple.streamingkeydelivery\" method: SAMPLE-AES uri: skd://drm-demo-3.la.drm.cloud/acquire-license/fairplay?brandGuid=${brandGuid}&KID=a8107b56-3674-4301-a6d5-c3dc058fcbac&IV=ca177443b63ad9823fa0460b6e384d7d)"
[Log] [log] > – "[audio-stream-controller]:" – "Loading fragment 6662 cc: 10 of [6645-6664] track: 0, target: 51.082" (hls__js.js, line 8487)
[Log] [log] > – "[audio-stream-controller]:" – "KEY_LOADING->FRAG_LOADING" (hls__js.js, line 9177)
[Log] [log] > – "[eme]" – "Handle encrypted media sn: 6662 audio: 0 using key (keyId: 00000000000000000000000000000001 format: \"com.apple.streamingkeydelivery…" (hls__js.js, line 20207)
"Handle encrypted media sn: 6662 audio: 0 using key (keyId: 00000000000000000000000000000001 format: \"com.apple.streamingkeydelivery\" method: SAMPLE-AES uri: skd://drm-demo-3.la.drm.cloud/acquire-license/fairplay?brandGuid=${brandGuid}&KID=a8107b56-3674-4301-a6d5-c3dc058fcbac&IV=ca177443b63ad9823fa0460b6e384d7d)"
[Log] [log] > – "[eme]" – "Setting media-keys for \"com.apple.fps\"" (hls__js.js, line 20370)
[Log] [log] > – "[eme]" – "Media-keys set for \"com.apple.fps\"" (hls__js.js, line 20379)
[Log] [log] > – "[eme]" – "Creating key-system session \"com.apple.fps\" keyId: 00000000000000000000000000000001" (hls__js.js, line 20131)
[Log] [log] > – "[eme]" – "Skipping key-session request for \"playlist-key\" (no initData)" (hls__js.js, line 20404)
[Log] [log] > – "[transmuxer-interface, audio]: Starting new transmux session for sn: 6662 p: -1 level: 0 id: 1↵        discontinuity: true↵      …" (hls__js.js, line 14137)
"[transmuxer-interface, audio]: Starting new transmux session for sn: 6662 p: -1 level: 0 id: 1
        discontinuity: true
        trackSwitch: true
        contiguous: false
        accurateTimeOffset: false
        timeOffset: 51.052000000000014
        initSegmentChange: true"
[Log] [log] > – "[audio-stream-controller]:" – "FRAG_LOADING->PARSING" (hls__js.js, line 9177)
[Log] [log] > – "[audio-stream-controller]:" – "Init audio buffer, container:audio/mp4, codecs[level/parsed]=[mp4a.40.2/mp4a.40.2]" (hls__js.js, line 14955)
[Log] [log] > – "[buffer-controller]" – "0 bufferCodec event(s) expected audio" (hls__js.js, line 16460)
[Log] [log] > – "[buffer-controller]" – "creating sourceBuffer(video/mp4;codecs=avc1.4D4028)" (hls__js.js, line 16890)
[Log] [log] > – "[buffer-controller]" – "creating sourceBuffer(audio/mp4;codecs=mp4a.40.2)" (hls__js.js, line 16890)
[Log] [log] > – "[stream-controller]:" – "Alternate track found, use video.buffered to schedule main fragment loading" (hls__js.js, line 24376)
[Log] [log] > – "[audio-stream-controller]:" – "Loaded fragment 6662 of level 0" (hls__js.js, line 8235)
[Log] [log] > – "[transmuxer.ts]: Flushed fragment 6662 of level 0" (hls__js.js, line 13646)
[Log] [log] > – "[audio-stream-controller]:" – "PARSING->PARSED" (hls__js.js, line 9177)
[Debug] [debug] > – "[eme]" – "\"encrypted\" event: init data type: \"sinf\"" (hls__js.js, line 20275)
[Log] [log] > – "[eme]" – "Generating key-session request for \"encrypted-event-key-match\": c7b00df9b14f4e08a98663289bba7c89 (init data type: sinf length: 147)" (hls__js.js, line 20408)
[Log] [log] > – "[eme]" – "\"waitingforkey\" event" (hls__js.js, line 20366)
[Debug] [debug] > – "[eme]" – "\"encrypted\" event: init data type: \"sinf\"" (hls__js.js, line 20275)
[Log] [log] > – "[eme]" – "Generating key-session request for \"encrypted-event-key-match\": a8107b5636744301a6d5c3dc058fcbac (init data type: sinf length: 147)" (hls__js.js, line 20408)
[Log] [log] > – "[eme]" – "Request generated for key-session \"8186958530364354403\" keyId: c7b00df9b14f4e08a98663289bba7c89" (hls__js.js, line 20477)
[Log] [log] > – "[eme]" – "Request generated for key-session \"1697182875904243195\" keyId: a8107b5636744301a6d5c3dc058fcbac" (hls__js.js, line 20477)
[Log] [log] > – "[eme]" – "\"license-request\" message event for session \"8186958530364354403\" message size: 4400" (hls__js.js, line 20420)
[Log] [log] > – "[eme]" – "Sending license request to URL: https://drm-demo-3.la.drm.cloud/acquire-license/fairplay?brandGuid=${brandGuid}&user…" (hls__js.js, line 20646)
"Sending license request to URL: https://drm-demo-3.la.drm.cloud/acquire-license/fairplay?brandGuid=${brandGuid}&userToken=${userToken}"
[Log] [log] > – "[eme]" – "\"license-request\" message event for session \"1697182875904243195\" message size: 5040" (hls__js.js, line 20420)
[Log] [log] > – "[eme]" – "Sending license request to URL: https://drm-demo-3.la.drm.cloud/acquire-license/fairplay?brandGuid=${brandGuid}&user…" (hls__js.js, line 20646)
"Sending license request to URL: https://drm-demo-3.la.drm.cloud/acquire-license/fairplay?brandGuid=${brandGuid}&userToken=${userToken}"
[Log] [log] > – "[eme]" – "License received 428" (hls__js.js, line 20657)
[Log] URL =====> Response – "https://drm-demo-3.la.drm.cloud/acquire-license/fairplay?brandGuid=${brandGuid}&userToken=eyJhbGciOiJIUzI1NiIsInR5cC…" (HlsJs.tsx, line 69)
"https://drm-demo-3.la.drm.cloud/acquire-license/fairplay?brandGuid=${brandGuid}&userToken=${userToken}"
[Log] Key Context =====> Response – {decryptdata: _LevelKey, keySystem: "com.apple.fps", mediaKeys: MediaKeys, …} (HlsJs.tsx, line 70)
{decryptdata: _LevelKey, keySystem: "com.apple.fps", mediaKeys: MediaKeys, mediaKeysSession: MediaKeySession, keyStatus: "status-pending", …}Object
[Log] [log] > – "[eme]" – "Updating key-session \"1697182875904243195\" for keyID a8107b5636744301a6d5c3dc058fcbac↵      } (data length: 428)" (hls__js.js, line 20167)
"Updating key-session \"1697182875904243195\" for keyID a8107b5636744301a6d5c3dc058fcbac
      } (data length: 428)"
[Log] [log] > – "[eme]" – "License received 460" (hls__js.js, line 20657)
[Log] URL =====> Response (HlsJs.tsx, line 69)
"https://drm-demo-3.la.drm.cloud/acquire-license/fairplay?brandGuid=${brandGuid}&userToken=${userToken}"
[Log] Key Context =====> Response – {decryptdata: _LevelKey, keySystem: "com.apple.fps", mediaKeys: MediaKeys, …} (HlsJs.tsx, line 70)
{decryptdata: _LevelKey, keySystem: "com.apple.fps", mediaKeys: MediaKeys, mediaKeysSession: MediaKeySession, keyStatus: "status-pending", …}Object
[Log] [log] > – "[eme]" – "Updating key-session \"8186958530364354403\" for keyID c7b00df9b14f4e08a98663289bba7c89↵      } (data length: 460)" (hls__js.js, line 20167)
"Updating key-session \"8186958530364354403\" for keyID c7b00df9b14f4e08a98663289bba7c89
      } (data length: 460)"
[Log] [log] > – "[level-controller]:" – "Loading level index 0 with https://05bce4580d95b32a.mediapackage.ap-southeast-1.amazonaws.com/out/v1/fd71e74c646b48b2be5d4228c20338ea/cloud_…" (hls__js.js, line 23205)
"Loading level index 0 with https://05bce4580d95b32a.mediapackage.ap-southeast-1.amazonaws.com/out/v1/fd71e74c646b48b2be5d4228c20338ea/cloud_drm_cmaf_apple/index_1.m3u8"
[Log] [log] > – "[audio-track-controller]:" – "loading audio-track playlist 0 \"und\" lang:und group:audio_0" (hls__js.js, line 15300)
[Error] [error] > – "[eme]" – "Type error"
	handleError (hls__js.js:20232)
	(anonymous function) (hls__js.js:20423)
[Log] [log] > – "[stream-controller]:" – "PARSED->ERROR" (hls__js.js, line 9177)
[Log] [log] > – "[audio-stream-controller]:" – "PARSED->ERROR" (hls__js.js, line 9177)
[Log] [log] > – "stopLoad" (hls__js.js, line 25103)
[Log] [log] > – "[stream-controller]:" – "ERROR->STOPPED" (hls__js.js, line 9177)
[Log] [log] > – "[audio-stream-controller]:" – "ERROR->STOPPED" (hls__js.js, line 9177)
[Log] [log] > – "[subtitle-stream-controller]:" – "IDLE->STOPPED" (hls__js.js, line 9177)
[Log] hlsError (HlsJs.tsx, line 87)
[Log] {type: "keySystemError", details: "keySystemSessionUpdateFailed", error: TypeError: Type error, fatal: true, err: TypeError: Type error} (HlsJs.tsx, line 88)
[Error] [error] > – "[eme]" – "Type error"
	handleError (hls__js.js:20232)
	(anonymous function) (hls__js.js:20423)
[Log] [log] > – "[stream-controller]:" – "STOPPED->ERROR" (hls__js.js, line 9177)
[Log] [log] > – "[audio-stream-controller]:" – "STOPPED->ERROR" (hls__js.js, line 9177)
[Log] [log] > – "stopLoad" (hls__js.js, line 25103)
[Log] [log] > – "[stream-controller]:" – "ERROR->STOPPED" (hls__js.js, line 9177)
[Log] [log] > – "[audio-stream-controller]:" – "ERROR->STOPPED" (hls__js.js, line 9177)
[Log] hlsError (HlsJs.tsx, line 87)
[Log] {type: "keySystemError", details: "keySystemSessionUpdateFailed", error: TypeError: Type error, fatal: true, err: TypeError: Type error} (HlsJs.tsx, line 88)
[Log] [log] > – "[eme]" – "Remove licenses and keys and close session 1697182875904243195" (hls__js.js, line 20767)
[Log] [log] > – "[eme]" – "Remove licenses and keys and close session 8186958530364354403" (hls__js.js, line 20767)
[Error] [error] > – "[eme]" – "Type error"
	handleError (hls__js.js:20232)
[Log] [log] > – "[stream-controller]:" – "STOPPED->ERROR" (hls__js.js, line 9177)
[Log] [log] > – "[audio-stream-controller]:" – "STOPPED->ERROR" (hls__js.js, line 9177)
[Log] [log] > – "stopLoad" (hls__js.js, line 25103)
[Log] [log] > – "[stream-controller]:" – "ERROR->STOPPED" (hls__js.js, line 9177)
[Log] [log] > – "[audio-stream-controller]:" – "ERROR->STOPPED" (hls__js.js, line 9177)
[Log] hlsError (HlsJs.tsx, line 87)
[Log] {type: "keySystemError", details: "keySystemSessionUpdateFailed", error: TypeError: Type error, fatal: true, err: TypeError: Type error} (HlsJs.tsx, line 88)
[Error] [error] > – "[eme]" – "Type error"
	handleError (hls__js.js:20232)
[Log] [log] > – "[stream-controller]:" – "STOPPED->ERROR" (hls__js.js, line 9177)
[Log] [log] > – "[audio-stream-controller]:" – "STOPPED->ERROR" (hls__js.js, line 9177)
[Log] [log] > – "stopLoad" (hls__js.js, line 25103)
[Log] [log] > – "[stream-controller]:" – "ERROR->STOPPED" (hls__js.js, line 9177)
[Log] [log] > – "[audio-stream-controller]:" – "ERROR->STOPPED" (hls__js.js, line 9177)
[Log] hlsError (HlsJs.tsx, line 87)
[Log] {type: "keySystemError", details: "keySystemSessionUpdateFailed", error: TypeError: Type error, fatal: true, err: TypeError: Type error} (HlsJs.tsx, line 88)
[Log] [log] > – "[eme]" – "Could not remove session: NotSupportedError: The operation is not supported." (hls__js.js, line 20785, x2)
[Error] Unhandled Promise Rejection: AbortError: The operation was aborted.
[Warning] [warn] > – "[audio-stream-controller]:" – "Fragment 6662 of level 0 finished buffering, but was aborted. state: STOPPED, audioSwitch: false" (hls__js.js, line 14782)
[Warning] [warn] > – "[stream-controller]:" – "Fragment 6662 of level 0 finished buffering, but was aborted. state: STOPPED" (hls__js.js, line 24391)

And here's for the config

{
      debug: true,
      emeEnabled: true,
      licenseXhrSetup(xhr, url, keyContext, lisenceChallenge) {
        const urlObject: URL = new URL(url.replace("skd://", "https://"));
        const keyId: string = stringify(
          keyContext.decryptdata?.keyId ?? Uint8Array.from([])
        );

        urlObject.searchParams.append("KID", keyId);
        xhr.open("POST", urlObject.toString());
        xhr.setRequestHeader("Content-Type", "application/octet-stream");
        return lisenceChallenge;
      },
      drmSystems: {
        "com.apple.fps": {
          licenseUrl: `https://drm-demo-3.la.drm.cloud/acquire-license/fairplay?brandGuid=${brandGuid}&userToken=${user?.drmLisence}`,
          serverCertificateUrl:
            "https://drm-demo-3.la.drm.cloud/certificate/fairplay?brandGuid=${brandGuid}",
        },
      },
      licenseResponseCallback(xhr, url, keyContext) {
        console.log("URL =====> Response", url);
        console.log("Key Context =====> Response", keyContext);
        return xhr.response;
      },
    };
  

did i miss something?

Really appreciate to anyone that help me to solve the problem
thank you

What have you tried so far?

No response

@momyuke momyuke added Needs Triage If there is a suspected stream issue, apply this label to triage if it is something we should fix. Question labels Nov 28, 2024
@momyuke momyuke changed the title keySystemUpdateSessionFailed error keySystemSessionUpdateFailed error Nov 28, 2024
@robwalch
Copy link
Collaborator

I'd recommend contacting your DRM provider and verifying that the license and certificate URLs and parameters are correct.

@momyuke
Copy link
Author

momyuke commented Nov 28, 2024

I'd recommend contacting your DRM provider and verifying that the license and certificate URLs and parameters are correct.

Hi @robwalch thanks for the response. While i'm still asking to my drm provider.
Is it still possible to have an incorrect parameter while in the log the license xhr was sucessfully called? i'm checking the network and the certificate was there, but when updating the keys it throw an error.

The keys that returned was arraybuffer, is it incorrect response that causing error?

@robwalch
Copy link
Collaborator

The key message is converted to a Uint8Array here:

return this.updateKeySession(context, new Uint8Array(data)).catch(

@momyuke
Copy link
Author

momyuke commented Nov 29, 2024

I don't think the issue comes from drm provider, since hls.js successfully got the license. However, the .updateKeySession function throwing an error and i dont know why

@momyuke
Copy link
Author

momyuke commented Nov 29, 2024

Hello @robwalch sorry to bothering you.

I think there is some miss configuration from my config. For the first time, The certificate was successfully sended by drm provider. But when hls.js call the renewLicense, then the updateKeySession called. It become error

So i think there is some miss config, perhaps.

Starts from the licenseXhrSetup, is it okay to just return the licenseChallenge? Do I need to call send() function from XHR inside that function?

I'm really new for this kind of technology. So sorry to bother you again and again

@robwalch
Copy link
Collaborator

I don't think the issue comes from drm provider

No, but they should provide technical support with regards to your configuration, and help verify that the license is delivered correctly. They would also have instructions on how to format the response for JavaScript based players using EME.

@robwalch robwalch added the DRM label Nov 29, 2024
@robwalch
Copy link
Collaborator

Useful information provided in #6865, not included in this issue's description:

hls.js 1.5.17
Safari 17.5 (19618.2.12.11.6)
mac OS 14.5 (23F79) SONOMA

MediaPackage AWS service, and we are using SPEKE 2.0 for the content encryption.

  1. Try to play the live stream

That issue includes logs that differ from this one, where key-status reaches "usable". The logs above are more consistent with screenshots from #6865 showing a Type error on MediaKeySession.update.

The error suggests that the data passed to it was not formatted correctly.

@robwalch
Copy link
Collaborator

robwalch commented Nov 29, 2024

I have some testing experience with AWS MediaPackage SPEKE v2 media (DRM Today / Castlabs). The setup that works is as follows. Note that you need to include a 'x-dt-custom-data' request header when posting the license, which you should have already if you've got Widevine working:

{
  debug: true,
  emeEnabled: true,
  drmSystems: {
    'com.apple.fps': {
      licenseUrl: `${fpsLicenseUrl}`,
      serverCertificateUrl: `${fpsCertificateUrl}`,
    },
    'com.widevine.alpha': {
      licenseUrl: `${widevineLicenseUrl}`,
      generateRequest(initDataType, initData, context) {
        return { initDataType, initData };
      },
    },
    'com.microsoft.playready': {
      licenseUrl: `${playreadyLicenseUrl}`,
    },
  },
  licenseXhrSetup(xhr, url, keyContext, licenseChallenge) {
    if (keyContext.keySystem === 'com.apple.fps') {
      xhr.responseType = 'text';
    }
    xhr.open('POST', url, true);
    xhr.setRequestHeader(
      'x-dt-custom-data',
      `${drmTodayCustomData}`, // btoa(JSON.stringify(customDataFromDrmProvider)));
    );

    return licenseChallenge;
  },
  licenseResponseCallback(xhr, url, keyContext) {
    if (keyContext.keySystem === 'com.apple.fps') {
      const base64Decode = (base64encodedStr) =>
        Uint8Array.from(atob(base64encodedStr), (c) => c.charCodeAt(0));
      const data = base64Decode(xhr.response);
      return data.buffer;
    }
    return xhr.response;
  },
}

@robwalch robwalch added Duplicate and removed Needs Triage If there is a suspected stream issue, apply this label to triage if it is something we should fix. Duplicate labels Nov 29, 2024
@robwalch
Copy link
Collaborator

robwalch commented Nov 29, 2024

@momyuke
Copy link
Author

momyuke commented Nov 29, 2024

I have some testing experience with AWS MediaPackage SPEKE v2 media (DRM Today / Castlabs). The setup that works is as follows. Note that you need to include a 'x-dt-custom-data' request header when posting the license, which you should have already if you've got Widevine working:

{
  debug: true,
  emeEnabled: true,
  drmSystems: {
    'com.apple.fps': {
      licenseUrl: `${fpsLicenseUrl}`,
      serverCertificateUrl: `${fpsCertificateUrl}`,
    },
    'com.widevine.alpha': {
      licenseUrl: `${widevineLicenseUrl}`,
      generateRequest(initDataType, initData, context) {
        return { initDataType, initData };
      },
    },
    'com.microsoft.playready': {
      licenseUrl: `${playreadyLicenseUrl}`,
    },
  },
  licenseXhrSetup(xhr, url, keyContext, licenseChallenge) {
    if (keyContext.keySystem === 'com.apple.fps') {
      xhr.responseType = 'text';
    }
    xhr.open('POST', url, true);
    xhr.setRequestHeader(
      'x-dt-custom-data',
      `${drmTodayCustomData}`, // btoa(JSON.stringify(customDataFromDrmProvider)));
    );

    return licenseChallenge;
  },
  licenseResponseCallback(xhr, url, keyContext) {
    if (keyContext.keySystem === 'com.apple.fps') {
      const base64Decode = (base64encodedStr) =>
        Uint8Array.from(atob(base64encodedStr), (c) => c.charCodeAt(0));
      const data = base64Decode(xhr.response);
      return data.buffer;
    }
    return xhr.response;
  },
}

Thanks for the response @robwalch, i just realize that i need to send the spc data as binary. So how do i get the spc data, and turn it into the binary data?

@thasso
Copy link

thasso commented Dec 2, 2024

Just a note, we also have integration docs available for hls.js.

I am not entirely sure about the implementation in hls.js, but if this is going through the EME implementation for FPS, there should be no need further manipulate or transform the data when sending it out. The payload created by the key system should work for the POST. It is correct that the response needs to still be transformed. I will bring this up with the team since we should be able to also avoid this step.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants