Dash.js: Stream quality not changing immediately

Created on 30 Mar 2021  路  4Comments  路  Source: Dash-Industry-Forum/dash.js

Environment

  • Dash.js version: v3.2.1
  • Browser name/version: Chrome 89.0.4389.90
  • OS name/version: Ubuntu 20.04
Steps to reproduce
  1. Start playing the video
  2. Change the stream quality
  3. It wont change immediately
Observed behavior

On quality change, it is not reflected immediately.

Expected behavior

The quality should change and it should continue to play in that quality immediately

This is how Im changing the quality

let firstLoad = true;
      const dash = Dash.MediaPlayer().create();
      dash.on("manifestLoaded", (e) => {
        const _qualityLevels = (e.data as any).Period.AdaptationSet[0]
          .Representation;

        const qualityLevels = _qualityLevels.map((l: any) => l.height) as any[];

        options.quality = {
          default: qualityLevels[0],
          options: qualityLevels,
          forced: true,

          onChange: function (quality: number) {
            if (!firstLoad) {
              const t = qualityLevels.findIndex((q) => q === quality);
              console.log(t);
              dash.setQualityFor("video", t);
            }
            firstLoad = false;
          },
        };
        plyr = new Plyr(element!, options);
      });

      dash.initialize(element!, decodedUrl, true);
Bug

All 4 comments

Try enabling fastSwitch:

player.updateSettings({streaming: {fastSwitchEnabled: true}})
  • @property {boolean} [fastSwitchEnabled=false]

    • When enabled, after an ABR up-switch in quality, instead of requesting and appending the next fragment at the end of the current buffer range it is requested and appended closer to the current time.

    • When enabled, The maximum time to render a higher quality is current time + (1.5 * fragment duration).

    • Note, When ABR down-switch is detected, we appended the lower quality at the end of the buffer range to preserve the

      higher quality media for as long as possible.

    • If enabled, it should be noted there are a few cases when the client will not replace inside buffer range but rather just append at the end.






        1. When the buffer level is less than one fragment duration.








        1. The client is in an Abandonment State due to recent fragment abandonment event.






Ok now im seeing that the quality doesnt set to what i set, it automatically bumps it

Try to disable ABR if you dont want to automatically adjust the quality after a change:

const cfg = {streaming: {abr: {autoSwitchBitrate: {video: false}}}}
self.player.updateSettings(cfg);
self.player.setQualityFor('video', item.index - 1);

Yes that is definitely what I was missing. Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tony1377 picture tony1377  路  3Comments

ProLoser picture ProLoser  路  5Comments

fabienvallee picture fabienvallee  路  3Comments

AxelDelmas picture AxelDelmas  路  6Comments

ruslandinov picture ruslandinov  路  4Comments