mpd-parser icon indicating copy to clipboard operation
mpd-parser copied to clipboard

Multi audio track

Open Prathik9 opened this issue 1 year ago • 6 comments

Description

``I am not getting the core multi audio code where it is showing multi audio. Current vidojs is showing multi audio based on language i worked in local code to change it to show using id. because of in case language is undefined it show only one audio . But in the source code i didnt get the code to that . any one know please help me.

var organizeAudioPlaylists = function organizeAudioPlaylists(
    playlists,
    sidxMapping
  ) {
    if (sidxMapping === void 0) {
      sidxMapping = {};
    }
 
    var mainPlaylist;
    var formattedPlaylists = playlists.reduce(function (a, playlist) {
      var role =
        (playlist.attributes.role && playlist.attributes.role.value) || "";
 
      console.log("playlist.attributes.lang", playlist.attributes.lang);
      var language =
        playlist.attributes.lang == undefined
          ? playlist.attributes.lang
          : playlist.attributes.lang || "";
      var label = "main";
 
      if (language) {
        var label2 =
          playlist.attributes.lang == undefined
            ? playlist.attributes.id
            : playlist.attributes.lang || "";
        var label = "main";
        var roleLabel = role ? " (" + role + ")" : "";
        label = "" + label2 + roleLabel;
      } // skip if we already have the highest quality audio for a language
 
      if (
        a[label] &&
        a[label].playlists[0].attributes.BANDWIDTH >
          playlist.attributes.bandwidth
      ) {
        return a;
      }
 
      a[label] = {
        language: language,
        autoselect: true,
        default: role === "main",
        playlists: addSegmentInfoFromSidx(
          [formatAudioPlaylist(playlist)],
          sidxMapping
        ),
        uri: "",
      };
 
      if (typeof mainPlaylist === "undefined" && role === "main") {
        mainPlaylist = playlist;
        mainPlaylist["default"] = true;
      }
 
      return a;
    }, {}); // if no playlists have role "main", mark the first as main
 
    if (!mainPlaylist) {
      var firstLabel = Object.keys(formattedPlaylists)[0];
      formattedPlaylists[firstLabel]["default"] = true;
    }
 
    return formattedPlaylists;
  };

if i use .id insted of .lang it show multi audio option in ui even though language is undefined in manifest. i found this in dist folder of videojs whre can i find these in source code

Reduced test case

locally

Steps to reproduce

Errors

No response

What version of Video.js are you using?

7.21

Video.js plugins used.

no in core

What browser(s) including version(s) does this occur with?

all

What OS(es) and version(s) does this occur with?

windows 11

Prathik9 avatar Oct 18 '24 10:10 Prathik9

👋 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.

welcome[bot] avatar Oct 18 '24 10:10 welcome[bot]

That code is from https://github.com/videojs/mpd-parser

mister-ben avatar Oct 18 '24 14:10 mister-ben

Thanks @mister-ben plz help me with below also

how can i merge changes done here to the videojs . how it get reflect there , where i wwant to include this plugin or what.

Prathik9 avatar Oct 19 '24 09:10 Prathik9

@Prathik9 the mpd-parser is a dependency of videojs and VHS (the MSE video playback engine behind video.js' mpeg-DASH support). See the package.json.

adrums86 avatar Oct 21 '24 19:10 adrums86

I think this belongs in the mpd-parser so I moved it. We could potentially handle cases of lang being undefined a bit better, marking as an enhancement.

adrums86 avatar Oct 21 '24 20:10 adrums86

insted of language if we use id it shows in the ui otherwise , even the stream contain multi audio if its lack in laguage it shows single audio

Prathik9 avatar Oct 23 '24 14:10 Prathik9