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

Decryption failure with wrong key does not trigger ERROR listener #5250

Closed
lim-kim930 opened this issue Feb 22, 2023 · 6 comments
Closed

Decryption failure with wrong key does not trigger ERROR listener #5250

lim-kim930 opened this issue Feb 22, 2023 · 6 comments

Comments

@lim-kim930
Copy link

What do you want to do with Hls.js?

When I specified the wrong KEY in the m3u8 file, I found that hls.js will request all the remaining fragments after requesting the key file. I want to stop loading after judging that the decryption fails, so I set the ERROR listener. However, I I found that it was not triggered, is there any usage I missed?

What have you tried so far?

No response

@lim-kim930 lim-kim930 added Needs Triage If there is a suspected stream issue, apply this label to triage if it is something we should fix. Question labels Feb 22, 2023
@lim-kim930
Copy link
Author

lim-kim930 commented Feb 22, 2023

Here is my configuration:

{
    debug: true,
    enableWorker: true,
    lowLatencyMode: true,
}

Here is the console output, it appears to be trying to decrypt each frag, so the output is duplicated

[log] > Debug logs enabled for "Hls instance"
hls.js@latest:formatted:15711 [log] > stopLoad
hls.js@latest:formatted:15693 [log] > loadSource:http://192.168.8.108:3001/music/audio/index.m3u8
hls.js@latest:formatted:8295 [log] > [stream-controller]: Trigger BUFFER_RESET
hls.js@latest:formatted:15673 [log] > attachMedia
hls.js@latest:formatted:10604 [log] > [buffer-controller]: Media source opened
hls.js@latest:formatted:7439 [log] > [subtitle-stream-controller]: STOPPED->IDLE
hls.js@latest:formatted:5190 [log] > [level-controller]: manifest loaded, 1 level(s) found, first bitrate: 0
hls.js@latest:formatted:10689 [log] > 1 bufferCodec event(s) expected
hls.js@latest:formatted:15703 [log] > startLoad(-1)
hls.js@latest:formatted:5423 [log] > [level-controller]: switching to level 0 from -1
hls.js@latest:formatted:7439 [log] > [stream-controller]: STOPPED->IDLE
hls.js@latest:formatted:7439 [log] > [subtitle-stream-controller]: IDLE->STOPPED
hls.js@latest:formatted:7439 [log] > [subtitle-stream-controller]: STOPPED->IDLE
hls.js@latest:formatted:8328 [log] > [stream-controller]: Level 0 loaded [0,30], cc [0, 0] duration:300.73292399999997
hls.js@latest:formatted:11018 [log] > [buffer-controller]: Updating Media Source duration to 300.733
hls.js@latest:formatted:6893 [log] > [stream-controller]: Loading key for 0 of [0-30], level 0
hls.js@latest:formatted:7439 [log] > [stream-controller]: IDLE->KEY_LOADING
hls.js@latest:formatted:6939 [log] > [stream-controller]: Loading fragment 0 cc: 0 of [0-30] level: 0, target: 0
hls.js@latest:formatted:7439 [log] > [stream-controller]: KEY_LOADING->FRAG_LOADING
hls.js@latest:formatted:7587 [log] > demuxing in webworker
hls.js@latest:formatted:7711 [log] > [transmuxer-interface, main]: Starting new transmux session for sn: 0 p: -1 level: 0 id: 1
        discontinuity: true
        trackSwitch: true
        contiguous: false
        accurateTimeOffset: true
        timeOffset: 0
        initSegmentChange: true
hls.js@latest:formatted:6771 [log] > [stream-controller]: Loaded fragment 0 of level 0
blob:http://localhost:3001/ec50a096-96c6-4cb1-a63b-61aaa9bd169e:1 [log] > Debug logs enabled for "main"
hls.js@latest:formatted:7800 [log] > [decrypter]: JS AES decrypt
hls.js@latest:formatted:7800 [warn] > Failed to find demuxer by probing frag, treating as mp4 passthrough
e.onWorkerMessage @ hls.js@latest:formatted:7800
hls.js@latest:formatted:7800 [warn] > [passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes.
e.onWorkerMessage @ hls.js@latest:formatted:7800
hls.js@latest:formatted:7800 [warn] > [passthrough-remuxer.ts]: Failed to generate initSegment.
e.onWorkerMessage @ hls.js@latest:formatted:7800
hls.js@latest:formatted:7800 [log] > [transmuxer.ts]: Flushed fragment 0 of level 0
hls.js@latest:formatted:7439 [log] > [stream-controller]: FRAG_LOADING->PARSING
hls.js@latest:formatted:7416 [warn] > [stream-controller]: Found no media in fragment 0 of level 0 resetting transmuxer to fallback to playlist timing
d.updateLevelTiming @ hls.js@latest:formatted:7416
d._handleTransmuxerFlush @ hls.js@latest:formatted:7019
e.onWorkerMessage @ hls.js@latest:formatted:7797
hls.js@latest:formatted:7439 [log] > [stream-controller]: PARSING->PARSED
hls.js@latest:formatted:10913 [warn] > Fragments must have at least one ElementaryStreamType set. type: main level: 0 sn: 0
e.onFragParsed @ hls.js@latest:formatted:10913
o.emit @ hls.js@latest:formatted:17987
a.emit @ hls.js@latest:formatted:15628
a.trigger @ hls.js@latest:formatted:15633
d.updateLevelTiming @ hls.js@latest:formatted:7419
d._handleTransmuxerFlush @ hls.js@latest:formatted:7019
e.onWorkerMessage @ hls.js@latest:formatted:7797
hls.js@latest:formatted:11155 [log] > [buffer-controller]: Blocking operation requested, but no SourceBuffers exist
hls.js@latest:formatted:6861 [log] > [stream-controller]: Buffered main sn: 0 of level 0 (frag:[NaN-NaN] > buffer:)
hls.js@latest:formatted:7439 [log] > [stream-controller]: PARSED->IDLE
hls.js@latest:formatted:6939 [log] > [stream-controller]: Loading fragment 1 cc: 0 of [0-30] level: 0, target: 10.008
hls.js@latest:formatted:7439 [log] > [stream-controller]: IDLE->FRAG_LOADING
hls.js@latest:formatted:7587 [log] > demuxing in webworker
hls.js@latest:formatted:7711 [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: 10.0078
        initSegmentChange: true
hls.js@latest:formatted:6771 [log] > [stream-controller]: Loaded fragment 1 of level 0
blob:http://localhost:3001/5ef4502f-176d-4bfd-bc2e-64db84c0a131:1 [log] > Debug logs enabled for "main"
hls.js@latest:formatted:7800 [log] > [decrypter]: JS AES decrypt
hls.js@latest:formatted:7800 [warn] > Failed to find demuxer by probing frag, treating as mp4 passthrough
e.onWorkerMessage @ hls.js@latest:formatted:7800
hls.js@latest:formatted:7800 [warn] > [passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes.
e.onWorkerMessage @ hls.js@latest:formatted:7800
hls.js@latest:formatted:7800 [warn] > [passthrough-remuxer.ts]: Failed to generate initSegment.
e.onWorkerMessage @ hls.js@latest:formatted:7800
hls.js@latest:formatted:7800 [log] > [transmuxer.ts]: Flushed fragment 1 of level 0
hls.js@latest:formatted:7439 [log] > [stream-controller]: FRAG_LOADING->PARSING
hls.js@latest:formatted:7416 [warn] > [stream-controller]: Found no media in fragment 1 of level 0 resetting transmuxer to fallback to playlist timing
d.updateLevelTiming @ hls.js@latest:formatted:7416
d._handleTransmuxerFlush @ hls.js@latest:formatted:7019
e.onWorkerMessage @ hls.js@latest:formatted:7797
hls.js@latest:formatted:7439 [log] > [stream-controller]: PARSING->PARSED
hls.js@latest:formatted:10913 [warn] > Fragments must have at least one ElementaryStreamType set. type: main level: 0 sn: 1
e.onFragParsed @ hls.js@latest:formatted:10913
o.emit @ hls.js@latest:formatted:17987
a.emit @ hls.js@latest:formatted:15628
a.trigger @ hls.js@latest:formatted:15633
d.updateLevelTiming @ hls.js@latest:formatted:7419
d._handleTransmuxerFlush @ hls.js@latest:formatted:7019
e.onWorkerMessage @ hls.js@latest:formatted:7797
hls.js@latest:formatted:11155 [log] > [buffer-controller]: Blocking operation requested, but no SourceBuffers exist
hls.js@latest:formatted:6861 [log] > [stream-controller]: Buffered main sn: 1 of level 0 (frag:[NaN-NaN] > buffer:)
hls.js@latest:formatted:7439 [log] > [stream-controller]: PARSED->IDLE
hls.js@latest:formatted:6939 [log] > [stream-controller]: Loading fragment 2 cc: 0 of [0-30] level: 0, target: 20.016
hls.js@latest:formatted:7439 [log] > [stream-controller]: IDLE->FRAG_LOADING
hls.js@latest:formatted:7587 [log] > demuxing in webworker
hls.js@latest:formatted:7711 [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: 20.0156
        initSegmentChange: true
hls.js@latest:formatted:6771 [log] > [stream-controller]: Loaded fragment 2 of level 0
blob:http://localhost:3001/e80c175c-50e7-45c8-b89a-1fd22532180f:1 [log] > Debug logs enabled for "main"
hls.js@latest:formatted:7800 [log] > [decrypter]: JS AES decrypt
hls.js@latest:formatted:7800 [warn] > Failed to find demuxer by probing frag, treating as mp4 passthrough
e.onWorkerMessage @ hls.js@latest:formatted:7800
hls.js@latest:formatted:7800 [warn] > [passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes.
e.onWorkerMessage @ hls.js@latest:formatted:7800
hls.js@latest:formatted:7800 [warn] > [passthrough-remuxer.ts]: Failed to generate initSegment.
e.onWorkerMessage @ hls.js@latest:formatted:7800
hls.js@latest:formatted:7800 [log] > [transmuxer.ts]: Flushed fragment 2 of level 0
hls.js@latest:formatted:7439 [log] > [stream-controller]: FRAG_LOADING->PARSING
hls.js@latest:formatted:7416 [warn] > [stream-controller]: Found no media in fragment 2 of level 0 resetting transmuxer to fallback to playlist timing
d.updateLevelTiming @ hls.js@latest:formatted:7416
d._handleTransmuxerFlush @ hls.js@latest:formatted:7019
e.onWorkerMessage @ hls.js@latest:formatted:7797
hls.js@latest:formatted:7439 [log] > [stream-controller]: PARSING->PARSED
hls.js@latest:formatted:10913 [warn] > Fragments must have at least one ElementaryStreamType set. type: main level: 0 sn: 2
e.onFragParsed @ hls.js@latest:formatted:10913
o.emit @ hls.js@latest:formatted:17987
a.emit @ hls.js@latest:formatted:15628
a.trigger @ hls.js@latest:formatted:15633
d.updateLevelTiming @ hls.js@latest:formatted:7419
d._handleTransmuxerFlush @ hls.js@latest:formatted:7019
e.onWorkerMessage @ hls.js@latest:formatted:7797
hls.js@latest:formatted:11155 [log] > [buffer-controller]: Blocking operation requested, but no SourceBuffers exist
hls.js@latest:formatted:6861 [log] > [stream-controller]: Buffered main sn: 2 of level 0 (frag:[NaN-NaN] > buffer:)
hls.js@latest:formatted:7439 [log] > [stream-controller]: PARSED->IDLE
hls.js@latest:formatted:6939 [log] > [stream-controller]: Loading fragment 3 cc: 0 of [0-30] level: 0, target: 30
hls.js@latest:formatted:7439 [log] > [stream-controller]: IDLE->FRAG_LOADING
hls.js@latest:formatted:7587 [log] > demuxing in webworker

@robwalch robwalch removed the Needs Triage If there is a suspected stream issue, apply this label to triage if it is something we should fix. label Feb 22, 2023
@robwalch
Copy link
Collaborator

robwalch commented Feb 22, 2023

Hi @lim-kim930,

I see from the logs it's failing with [warn] > Failed to find demuxer by probing frag, treating as mp4 passthrough (and no media warning following that). This is fixed in:

You can expect this to produce a FRAG_PARSING_ERROR.

@robwalch
Copy link
Collaborator

Not a Contribution

You can preview the changes here https://deploy-preview-5241--hls-js-dev.netlify.app/demo/

@robwalch robwalch added this to the 1.4.0 milestone Feb 22, 2023
@robwalch
Copy link
Collaborator

Duplicates #5011

@lim-kim930
Copy link
Author

Thanks a lot, I did see the error output in the preview version, looking forward to the 1.4.0 version.

@robwalch robwalch added the Verify Fixed An unreleased bug fix has been merged and should be verified before closing. label Mar 3, 2023
@robwalch robwalch removed the Verify Fixed An unreleased bug fix has been merged and should be verified before closing. label Apr 12, 2023
@robwalch
Copy link
Collaborator

Marking as fixed in v1.4.0.

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

2 participants