Closed mikemerritt closed 2 years ago
the same issue
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
We see what seems to be the same issue when audio is AES-128 encrypted. I believe there's a race condition during initialization where an audio decryption error sometimes occurs, depending on the order of the following events:
I have not pinpointed the cause, but here is the order of HTTP requests in one case where I observed the error:
Note that the audio key is not received until several requests for the first audio segment have been received.
Log snippet (full log here):
logger.js:40 [log] > main stream-controller: IDLE->FRAG_LOADING
logger.js:40 [log] > track 0 loaded [60,1524],duration:2936.6661180000497
logger.js:40 [log] > start time offset found in playlist, adjust startPosition to 0.005922
logger.js:40 [log] > Loading initSegment, cc: undefined of [60 ,1524],track 0, currentTime:0.005922,bufferEnd:0.006
logger.js:40 [log] > audio stream:IDLE->FRAG_LOADING
logger.js:40 [log] > audioTrack 0 loaded
logger.js:40 [log] > Loaded initSegment of [60 ,1527],level 4
logger.js:40 [log] > main stream-controller: FRAG_LOADING->IDLE
logger.js:40 [log] > Loading key for 60 of [60 ,1527],level 4
logger.js:40 [log] > main stream-controller: IDLE->KEY_LOADING
logger.js:40 [warn] > frag loader destroy or aborted, disarm abandonRules
logger.js:40 [log] > audio stream:FRAG_LOADING->IDLE
logger.js:40 [log] > Loading key for 60 of [60 ,1524],track 0
logger.js:40 [log] > audio stream:IDLE->KEY_LOADING
logger.js:40 [log] > main stream-controller: KEY_LOADING->IDLE
logger.js:40 [log] > switching to level 0
logger.js:40 [debug] > Loading playlist of type level, level: 0, id: 0
logger.js:40 [debug] > Calling internal loader delegate for URL: https://host-38-142-50-110.contentfabric.io/qlibs/ilib4Db4bZJWkLTvqpFqFUHhfF7rGXBm/q/hq__JoCEZvVxM27uH7yaf94gf1mMBWzybo5JXPPcBqEitMd6NHyLpzErq6vqUTSy9qqQEjXYJAYveb/rep/playout/default/hls-aes128/video/video_640x360@400000/playlist.m3u8
logger.js:40 [log] > main stream-controller: IDLE->WAITING_LEVEL
logger.js:40 [log] > audio stream:KEY_LOADING->IDLE
logger.js:40 [log] > Loading key for 60 of [60 ,1524],track 0
logger.js:40 [log] > audio stream:IDLE->KEY_LOADING
logger.js:40 [log] > audio stream:KEY_LOADING->IDLE
logger.js:40 [log] > Loading 60, cc: 0 of [60 ,1524],track 0, currentTime:0.005922,bufferEnd:0.006
logger.js:40 [log] > audio stream:IDLE->FRAG_LOADING
logger.js:40 [log] > level 0 loaded [60,1527],duration:2937.3298329999448
logger.js:40 [log] > main stream-controller: WAITING_LEVEL->IDLE
logger.js:40 [log] > Loading initSegment of [60 ,1527],level 0, currentTime:0.104,bufferEnd:0.104
logger.js:40 [log] > main stream-controller: IDLE->FRAG_LOADING
logger.js:40 [log] > audio stream:FRAG_LOADING->PARSING
logger.js:40 [log] > demuxing in webworker
logger.js:40 [log] > Demuxing 60 of [60 ,1524],track 0
logger.js:40 [log] > audio:discontinuity detected
logger.js:40 [log] > audio:switch detected
blob:http://localhost:8000/a1220b61-0939-4931-a3fc-26177733c756:562 [log] > WebCrypto AES decrypt
blob:http://localhost:8000/a1220b61-0939-4931-a3fc-26177733c756:562 [log] > WebCrypto Error, disable WebCrypto API
blob:http://localhost:8000/a1220b61-0939-4931-a3fc-26177733c756:562 [log] > JS AES decrypt
main.js:539 Error event: {type: "mediaError", details: "fragParsingError", fatal: true, reason: "no demux matching with content found", frag: Fragment, …}type: "mediaError"details: "fragParsingError"fatal: truereason: "no demux matching with content found"frag: Fragmenturl: (...)byteRange: (...)byteRangeStartOffset: (...)byteRangeEndOffset: (...)decryptdata: (...)endProgramDateTime: (...)encrypted: (...)_url: "https://host-38-142-50-110.contentfabric.io/qlibs/ilib4Db4bZJWkLTvqpFqFUHhfF7rGXBm/q/hq__JoCEZvVxM27uH7yaf94gf1mMBWzybo5JXPPcBqEitMd6NHyLpzErq6vqUTSy9qqQEjXYJAYveb/rep/playout/default/hls-aes128/audio/audio@128000/60.m4s"_byteRange: null_decryptdata: LevelKey {_uri: "https://host-38-142-50-110.contentfabric.io/qlibs/…jdpQ3hoMVAxRWVXQkgyTm1DWFBH&player_profile=hls-js", baseuri: "https://host-38-142-50-110.contentfabric.io/qlibs/…jdpQ3hoMVAxRWVXQkgyTm1DWFBH&player_profile=hls-js", reluri: "../key.bin?authorization=eyJxc3BhY2VfaWQiOiJpc3BjM…jdpQ3hoMVAxRWVXQkgyTm1DWFBH&player_profile=hls-js", method: "AES-128", key: Uint8Array(16), …}_elementaryStreams: {audio: false, video: false}deltaPTS: 0rawProgramDateTime: nullprogramDateTime: nulltitle: nulltagList: (15) [Array(1), Array(2), Array(2), Array(1), Array(2), Array(2), Array(1), Array(2), Array(2), Array(1), Array(2), Array(2), Array(2), Array(2), Array(2)]cc: 0type: "audio"relurl: "60.m4s?authorization=eyJxc3BhY2VfaWQiOiJpc3BjM0FOb1ZTek5BM1A2dDdhYkxSNjlobzVZUFBaVSIsInFsaWJfaWQiOiJpbGliNERiNGJaSldrTFR2cXBGcUZVSGhmRjdyR1hCbSIsImFkZHIiOiIweEQ0RGE5NjczMzA3RDM1ODBkNjI4OUM1QjgxZTI2ZjgxMjAxN0U1MTMiLCJxaWQiOiJpcV9fMlR4WjU3M2NWcjk1NG5YVVo3R0ZmbWZiamJ4SyIsImdyYW50IjoicmVhZCIsInR4X3JlcXVpcmVkIjpmYWxzZSwiaWF0IjoxNTg2MzcyMTU1LCJleHAiOjE1ODY0NTg1NTUsImF1dGhfc2lnIjoiRVMyNTZLXzN1M1cyeVdheHdocTZSc0FiRUVIS3ZDMVNhNDJYNmlBblJVbm5yNm82b3dENlNXR29KR05ybmNWN1NqZFZqWURyMmpMWVBjdUdwTER3ZUhYUmJndWV0a1ZOIiwiYWZnaF9wayI6IiJ9.RVMyNTZLX014MVBOamF2NHF5akJ5eFY0TmJuWVJ4UTRGUjhnZ3QxcWpNcUVzalJZRXRiOFNUbmhyYVR6a29OeEh4VmQ5R0V1eVVEbjdpQ3hoMVAxRWVXQkgyTm1DWFBH&player_profile=hls-js"baseurl: "https://host-38-142-50-110.contentfabric.io/qlibs/ilib4Db4bZJWkLTvqpFqFUHhfF7rGXBm/q/hq__JoCEZvVxM27uH7yaf94gf1mMBWzybo5JXPPcBqEitMd6NHyLpzErq6vqUTSy9qqQEjXYJAYveb/rep/playout/default/hls-aes128/audio/audio@128000/playlist.m3u8"duration: 2.005333start: 0sn: 60urlId: 0level: 0levelkey: LevelKey {_uri: "https://host-38-142-50-110.contentfabric.io/qlibs/…jdpQ3hoMVAxRWVXQkgyTm1DWFBH&player_profile=hls-js", baseuri: "https://host-38-142-50-110.contentfabric.io/qlibs/…jdpQ3hoMVAxRWVXQkgyTm1DWFBH&player_profile=hls-js", reluri: "../key.bin?authorization=eyJxc3BhY2VfaWQiOiJpc3BjM…jdpQ3hoMVAxRWVXQkgyTm1DWFBH&player_profile=hls-js", method: "AES-128", key: Uint8Array(16), …}loader: undefinedloaded: 19312__proto__: Objectid: "audio"__proto__: Object
The errors from the log:
A side note: I don't get why the player switches variants so fast in the beginning. Shouldn't it pick one and wait for some measurements first?
For those of you who have participated in this issue, would you please test against https://hls-js-dev.netlify.app/demo/ and let me know if the issue persists?
If so, please provide a test stream or, at the very least complete instructions / configuration for your MediaConvert encrypted stream (TS or CMAF, audio tracks, etc...). Note that including a hosted sample stream that can be used to reproduce will help prioritize issues over those that do not. Issues without samples may not be triaged because of the level of effort required.
Recently, #3782 fixed #3772 an issue with AES-128 and AAC segments so maybe this did the trick?
Closing until a test stream is provided to confirm this is still reproducible.
anyone find any solution??
I am hving the issue
What do you want to do with Hls.js? I am trying to play an encrypted HLS stream that is transcoded via AWS Elemental MediaConvert. The stream plays fine with encryption disabled but when enabled I get the following error.
{ type: "mediaError", details: "fragParsingError", fatal: true, reason: "no demux matching with content found" }
What have you tried so far?
I re-transcoded the file with no encryption and it plays perfectly. This leads me to believe it's not actually a demux issue and is a decryption issue. The fragment looks like it decrypts successfully as the
FRAG_DECRYPTED
event is fired and it looks like valid frag data, but I'm unsure. I've found some other issues about theno demux matching with content found
error but those all seem to be related to an invalid container format, but that doesn't seem to explain my issue as the container works fine when decryption is disabled.Here are the encryption settings from MediaConvert
Here is the output with debug enabled. I logged out the fragment when the decryption event fires.
And here is the full error data with fragment data included. This is a test encryption key.