Skip to content

Multi audio track #182

Open
Open
@Prathik9

Description

@Prathik9

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions