Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi audio track #182

Open
Prathik9 opened this issue Oct 18, 2024 · 6 comments
Open

Multi audio track #182

Prathik9 opened this issue Oct 18, 2024 · 6 comments

Comments

@Prathik9
Copy link

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

Copy link

welcome bot commented Oct 18, 2024

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

@mister-ben
Copy link
Contributor

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

@Prathik9
Copy link
Author

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.

@adrums86
Copy link
Contributor

@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 adrums86 transferred this issue from videojs/video.js Oct 21, 2024
@adrums86
Copy link
Contributor

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.

@Prathik9
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants