videojs/http-streaming

Can not find default audio group after switching qualitylevels

KaasJ opened this issue ยท 2 comments

KaasJ commented

Description

Videos without audio (adaptionset) in the manifest get a forced default audio group (see media-groups.js). We run into an error when switching to another qualitylevels of the video available in the manifest. The exact error is "Cannot use 'in' operator to search for 'default' in undefined". This error originates from the 'removeOldMediaGroupLabels' function in the dash-playlist-loader.js file, which is called by one of the hooks.

It seems like that, after switching the qualitylevel of the video, its trying to remove the old (forced) default audio media group label in the newMain mediagroup while the group isn't there. This leads to an error in the console.

Sources

Default audio mediagroup is added here
Its trying to remove the default audio group label here

Steps to reproduce

  1. Play a video with multiple qualitylevels but without audio specified in its dash manifest (see example below).
  2. Switch qualitylevel. Either manually or automatically (e.g. by limiting your band width).
  3. Check error in console browser (tested in Chrome).

Results

Expected

No errors in the console. I would say if the default audio group can not be found in the new mediagroup, then skip deletion.

Also I'm wondering if its needed to have a forced audio group for videos without audio but im not to involved in the code.

Error output

Console error:
"ERROR TypeError: Cannot use 'in' operator to search 'default' in undefined"

videojs-http-streaming version

what version of videojs-http-streaming does this occur with?
videojs-http-streaming 3.9.0

videojs version

what version of videojs does this occur with?
video.js 8.7.0

Browsers

what browsers are affected? please include browser and version for each
Chrome Versie 120.0.6099.129

Manifest example

<?xml version="1.0"?>
<!-- MPD file Generated with GPAC version 2.0-rev2.0.0+dfsg1-2 at 2023-12-15T08:45:28.815Z -->
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" minBufferTime="PT1.500S" type="static" mediaPresentationDuration="PT0H0M53.760S" maxSubsegmentDuration="PT0H0M2.000S" profiles="urn:mpeg:dash:profile:isoff-on-demand:2011">
 <ProgramInformation moreInformationURL="http://gpac.io">
  <Title>012_manifest.mpd generated by GPAC</Title>
 </ProgramInformation>

 <Period duration="PT0H0M53.760S">
  <AdaptationSet segmentAlignment="true" maxWidth="2560" maxHeight="1440" maxFrameRate="25" par="16:9" lang="und" startWithSAP="1" subsegmentAlignment="true" subsegmentStartsWithSAP="1">
   <Representation id="1" mimeType="video/mp4" codecs="avc1.640032" width="2560" height="1440" frameRate="25" sar="1:1" bandwidth="2992705">
    <BaseURL>123_video_high.mp4</BaseURL>
    <SegmentBase indexRangeExact="true" indexRange="952-1307">
     <Initialization range="0-911"/>
    </SegmentBase>
   </Representation>
   <Representation id="2" mimeType="video/mp4" codecs="avc1.640032" width="2560" height="1440" frameRate="25" sar="1:1" bandwidth="848291">
    <BaseURL>456_video_low.mp4</BaseURL>
    <SegmentBase indexRangeExact="true" indexRange="952-1307">
     <Initialization range="0-911"/>
    </SegmentBase>
   </Representation>
   <Representation id="3" mimeType="video/mp4" codecs="avc1.640032" width="2560" height="1440" frameRate="25" sar="1:1" bandwidth="1733251">
    <BaseURL>789_video_medium.mp4</BaseURL>
    <SegmentBase indexRangeExact="true" indexRange="951-1306">
     <Initialization range="0-910"/>
    </SegmentBase>
   </Representation>
  </AdaptationSet>
 </Period>
</MPD>

๐Ÿ‘‹ Thanks for opening your first issue here! ๐Ÿ‘‹

If you're reporting a ๐Ÿž bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.
To help make it easier for us to investigate your issue, please follow the contributing guidelines.

We can reproduce the issue, and it's even worse for us: Once any quality switch happens, e.g. if the initial playback quality lies below the highest available quality, the video stops buffering and does not play after ~8 seconds, or seemingly some later multiple of segment duration. The forementioned error in the console comes directly after starting the playback. 

See screencast http-streaming-buffering-error.webm where it was reproduced in Firefox (occurs in Chrome, as well) using the MPD from the test site of this repository under https://videojs-http-streaming.netlify.app/

To reproduce it yourself, please use the following CodePen: https://codepen.io/cenetp/pen/mdgboQN (to make the error appear, make sure that your initial playback resolution is below 240p, like in the video).