video-dev / hls.js

HLS.js is a JavaScript library that plays HLS in browsers with support for MSE.
https://hlsjs.video-dev.org/demo
Other
14.66k stars 2.56k forks source link

audio only streaming (with SAMPLE-AES encryption ) can not play on HLS.js #5001

Open shun115 opened 1 year ago

shun115 commented 1 year ago

What version of Hls.js are you using?

v1.2.4

What browser (including version) are you using?

chrome 106.0.5249.119

What OS (including version) are you using?

macOS 12.6(21G115)

Test stream

https://tinyurl.com/5yvepxmy

Configuration

{
  "debug": true,
  "enableWorker": true,
  "lowLatencyMode": true,
  "backBufferLength": 90
}

Additional player setup steps

No response

Checklist

Steps to reproduce

  1. push apply button on Test stream

Expected behaviour

we can play audio.

What actually happened?

exception occured.

Console output

0593522d160ef12a33e404217757ccea1ab9df75.js:1 [log] > destroy
0593522d160ef12a33e404217757ccea1ab9df75.js:1 [log] > detachMedia
0593522d160ef12a33e404217757ccea1ab9df75.js:1 Using Hls.js config: {debug: true, enableWorker: true, lowLatencyMode: true, backBufferLength: 90}
0593522d160ef12a33e404217757ccea1ab9df75.js:1 [log] >
0593522d160ef12a33e404217757ccea1ab9df75.js:1 [log] > stopLoad
0593522d160ef12a33e404217757ccea1ab9df75.js:1 [log] > loadSource:https://deeplab-api.s3.ap-northeast-1.amazonaws.com/test.m3u8
0593522d160ef12a33e404217757ccea1ab9df75.js:1 [log] > [stream-controller]: Trigger BUFFER_RESET
0593522d160ef12a33e404217757ccea1ab9df75.js:1 [log] > attachMedia
0593522d160ef12a33e404217757ccea1ab9df75.js:1 [log] > [buffer-controller]: Media source opened
0593522d160ef12a33e404217757ccea1ab9df75.js:1 [log] > [subtitle-stream-controller]: STOPPED->IDLE
0593522d160ef12a33e404217757ccea1ab9df75.js:1 [log] > [level-controller]: manifest loaded, 1 level(s) found, first bitrate: 0
0593522d160ef12a33e404217757ccea1ab9df75.js:1 [log] > 1 bufferCodec event(s) expected
0593522d160ef12a33e404217757ccea1ab9df75.js:1 [log] > startLoad(-1)
0593522d160ef12a33e404217757ccea1ab9df75.js:1 [log] > [level-controller]: switching to level 0 from -1
0593522d160ef12a33e404217757ccea1ab9df75.js:1 [log] > [stream-controller]: STOPPED->IDLE
0593522d160ef12a33e404217757ccea1ab9df75.js:1 [log] > [subtitle-stream-controller]: IDLE->STOPPED
0593522d160ef12a33e404217757ccea1ab9df75.js:1 [log] > [subtitle-stream-controller]: STOPPED->IDLE
0593522d160ef12a33e404217757ccea1ab9df75.js:1 [log] > [stream-controller]: Level 0 loaded [1,2], cc [0, 0] duration:10
0593522d160ef12a33e404217757ccea1ab9df75.js:1 [log] > [buffer-controller]: Updating Media Source duration to 10.000
0593522d160ef12a33e404217757ccea1ab9df75.js:1 [log] > [stream-controller]: Loading key for 1 of [1-2], level 0
0593522d160ef12a33e404217757ccea1ab9df75.js:1 [log] > [stream-controller]: IDLE->KEY_LOADING
0593522d160ef12a33e404217757ccea1ab9df75.js:1 [log] > [stream-controller]: KEY_LOADING->IDLE
0593522d160ef12a33e404217757ccea1ab9df75.js:1 [log] > [stream-controller]: Loading fragment 1 cc: 0 of [1-2] level: 0, target: 0
0593522d160ef12a33e404217757ccea1ab9df75.js:1 [log] > [stream-controller]: IDLE->FRAG_LOADING
0593522d160ef12a33e404217757ccea1ab9df75.js:1 [log] > demuxing in webworker
0593522d160ef12a33e404217757ccea1ab9df75.js:1 [log] > [transmuxer-interface, main]: Starting new transmux session for sn: 1 p: -1 level: 0 id: 1
        discontinuity: true
        trackSwitch: true
        contiguous: false
        accurateTimeOffset: true
        timeOffset: 0
        initSegmentChange: true
0593522d160ef12a33e404217757ccea1ab9df75.js:1 [log] > [stream-controller]: Loaded fragment 1 of level 0
blob:https://hls-js.netlify.app/ee4b001d-fb88-4cde-bb9b-0a910eb26e8b:1 [log] >
0593522d160ef12a33e404217757ccea1ab9df75.js:1 [log] > ADTS sync word found !
0593522d160ef12a33e404217757ccea1ab9df75.js:1 [log] > [mp4-remuxer]: ISGenerated flag reset
0593522d160ef12a33e404217757ccea1ab9df75.js:1 [log] > [mp4-remuxer]: initPTS & initDTS reset
0593522d160ef12a33e404217757ccea1ab9df75.js:1 [log] > [transmuxer.ts]: Flushed fragment 1 of level 0
blob:https://hls-js.netlify.app/ee4b001d-fb88-4cde-bb9b-0a910eb26e8b:1 Uncaught (in promise) Error: [[object Object]] This demuxer does not support Sample-AES decryption
    at AACDemuxer.demuxSampleAes (blob:https://hls-js.netlify.app/ee4b001d-fb88-4cde-bb9b-0a910eb26e8b:1:117568)
    at Transmuxer.transmuxSampleAes (blob:https://hls-js.netlify.app/ee4b001d-fb88-4cde-bb9b-0a910eb26e8b:1:21947)
    at Transmuxer.transmux (blob:https://hls-js.netlify.app/ee4b001d-fb88-4cde-bb9b-0a910eb26e8b:1:21167)
    at Transmuxer.push (blob:https://hls-js.netlify.app/ee4b001d-fb88-4cde-bb9b-0a910eb26e8b:1:17804)
    at blob:https://hls-js.netlify.app/ee4b001d-fb88-4cde-bb9b-0a910eb26e8b:1:3240
demuxSampleAes @ blob:https://hls-js.netlify.app/ee4b001d-fb88-4cde-bb9b-0a910eb26e8b:1
transmuxSampleAes @ blob:https://hls-js.netlify.app/ee4b001d-fb88-4cde-bb9b-0a910eb26e8b:1
transmux @ blob:https://hls-js.netlify.app/ee4b001d-fb88-4cde-bb9b-0a910eb26e8b:1
push @ blob:https://hls-js.netlify.app/ee4b001d-fb88-4cde-bb9b-0a910eb26e8b:1
(anonymous) @ blob:https://hls-js.netlify.app/ee4b001d-fb88-4cde-bb9b-0a910eb26e8b:1
Promise.then (async)
(anonymous) @ blob:https://hls-js.netlify.app/ee4b001d-fb88-4cde-bb9b-0a910eb26e8b:1
0593522d160ef12a33e404217757ccea1ab9df75.js:1 [log] > [stream-controller]: FRAG_LOADING->PARSING
0593522d160ef12a33e404217757ccea1ab9df75.js:1 [warn] > [stream-controller]: Found no media in fragment 1 of level 0 resetting transmuxer to fallback to playlist timing
updateLevelTiming @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
_handleTransmuxerFlush @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
onWorkerMessage @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
0593522d160ef12a33e404217757ccea1ab9df75.js:1 [log] > [stream-controller]: PARSING->PARSED
0593522d160ef12a33e404217757ccea1ab9df75.js:1 [warn] > Fragments must have at least one ElementaryStreamType set. type: main level: 0 sn: 1
onFragParsed @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
emit @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
emit @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
trigger @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
updateLevelTiming @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
_handleTransmuxerFlush @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
onWorkerMessage @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
0593522d160ef12a33e404217757ccea1ab9df75.js:1 [log] > [buffer-controller]: Blocking operation requested, but no SourceBuffers exist
0593522d160ef12a33e404217757ccea1ab9df75.js:1 [log] > [stream-controller]: Buffered main sn: 1 of level 0 
0593522d160ef12a33e404217757ccea1ab9df75.js:1 [log] > [stream-controller]: PARSED->IDLE
0593522d160ef12a33e404217757ccea1ab9df75.js:1 [log] > [stream-controller]: Loading fragment 2 cc: 0 of [1-2] level: 0, target: 10
0593522d160ef12a33e404217757ccea1ab9df75.js:1 [log] > [stream-controller]: IDLE->FRAG_LOADING
0593522d160ef12a33e404217757ccea1ab9df75.js:1 [log] > demuxing in webworker
0593522d160ef12a33e404217757ccea1ab9df75.js:1 [log] > [transmuxer-interface, main]: Starting new transmux session for sn: 2 p: -1 level: 0 id: 1
        discontinuity: true
        trackSwitch: true
        contiguous: false
        accurateTimeOffset: true
        timeOffset: 10
        initSegmentChange: true
0593522d160ef12a33e404217757ccea1ab9df75.js:1 [log] > [stream-controller]: Loaded fragment 2 of level 0
blob:https://hls-js.netlify.app/c7c3a540-2976-4ef3-be37-62e48b23ee3d:1 [log] >
0593522d160ef12a33e404217757ccea1ab9df75.js:1 [warn] > Failed to find demuxer by probing frag, treating as mp4 passthrough
onWorkerMessage @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
0593522d160ef12a33e404217757ccea1ab9df75.js:1 Error event: {type: 'otherError', details: 'internalException', fatal: true, event: 'demuxerWorker', error: Error: Uncaught TypeError: Cannot read properties of undefined (reading 'byteLength')  (blob:https:…}
(anonymous) @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
emit @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
emit @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
trigger @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
TransmuxerInterface.worker.onerror @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
error (async)
TransmuxerInterface @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
_handleFragmentLoadProgress @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
progressCallback @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
onProgress @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
readystatechange @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
XMLHttpRequest.send (async)
loadInternal @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
load @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
(anonymous) @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
load @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
_doFragLoad @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
_loadFragForPlayback @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
loadFragment @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
loadFragment @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
doTickIdle @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
doTick @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
tick @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
fragBufferedComplete @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
onFragBuffered @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
emit @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
emit @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
trigger @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
onUnblocked @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
Promise.then (async)
blockBuffers @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
onFragParsed @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
emit @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
emit @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
trigger @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
updateLevelTiming @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
_handleTransmuxerFlush @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
onWorkerMessage @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
0593522d160ef12a33e404217757ccea1ab9df75.js:1 Fatal error : internalException
(anonymous) @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
emit @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
emit @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
trigger @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
TransmuxerInterface.worker.onerror @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
error (async)
TransmuxerInterface @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
_handleFragmentLoadProgress @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
progressCallback @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
onProgress @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
readystatechange @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
XMLHttpRequest.send (async)
loadInternal @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
load @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
(anonymous) @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
load @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
_doFragLoad @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
_loadFragForPlayback @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
loadFragment @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
loadFragment @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
doTickIdle @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
doTick @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
tick @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
fragBufferedComplete @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
onFragBuffered @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
emit @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
emit @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
trigger @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
onUnblocked @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
Promise.then (async)
blockBuffers @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
onFragParsed @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
emit @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
emit @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
trigger @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
updateLevelTiming @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
_handleTransmuxerFlush @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
onWorkerMessage @ 0593522d160ef12a33e404217757ccea1ab9df75.js:1
0593522d160ef12a33e404217757ccea1ab9df75.js:1 [log] > destroy
0593522d160ef12a33e404217757ccea1ab9df75.js:1 [log] > detachMedia
0593522d160ef12a33e404217757ccea1ab9df75.js:1 [log] > [buffer-controller]: media source detaching
0593522d160ef12a33e404217757ccea1ab9df75.js:1 [log] > [stream-controller]: FRAG_LOADING->STOPPED
0593522d160ef12a33e404217757ccea1ab9df75.js:1 [log] > [subtitle-stream-controller]: IDLE->STOPPED

Chrome media internals output

No response

robwalch commented 1 year ago

Error: [[object Object]] This demuxer does not support Sample-AES decryption

Identity Sample-AES is only supported with MPEG-2 Transport Stream with the TS demuxer. Other file formats (container-less audio files and mp4 container) are not supported.

If you intend to use Sample-AES without DRM in HLS.js, regardless of whether you are packaging audio and/or video, you need to output TS segments, or contribute support via a PR that can be added in a future release.

shun115 commented 1 year ago

@robwalch thank you for your reply.

Identity Sample-AES is only supported with MPEG-2 Transport Stream with the TS demuxer. Other file formats (container-less audio files and mp4 container) are not supported.

We tests M2TS container with AAC encoded audio only streaming, but same error occurs.

https://tinyurl.com/2akhb5v2

robwalch commented 1 year ago

We tests M2TS container with AAC encoded audio only streaming, but same error occurs. https://tinyurl.com/2akhb5v2

HLS.js is choosing the MP3 demuxer when probing these segments (similar to #5002). If you can remove the non-mp2ts bytes at the start of your segments then SAMPLE-AES with TS does work in 1.2.4. Otherwise wait for fix #5006 in 1.2.5 or use <=1.2.1 (does not address SAMPLE-AES identity with other segment types).