ExoPlayer icon indicating copy to clipboard operation
ExoPlayer copied to clipboard

support multi audio track playback

Open louiewh opened this issue 2 years ago • 1 comments

I using MergeDataSource which have a videoUrl 3 three audoUrl to play . and I want to two audioUrl play at the same time . Refer to those link How to Controls multi-track playback Synchronizing Playing Multiple Audio

I find that can't overide DefaultTrackSelector some function, there more function is private. can supply some way?

I want video and two audio can play at the same. one audio track can select track.

louiewh avatar Jul 21 '22 11:07 louiewh

public final TrackSelectorResult selectTracks(

    for (int groupIndex = 0; groupIndex < trackGroups.length; groupIndex++) {
      TrackGroup group = trackGroups.get(groupIndex);
      // Associate the group to a preferred renderer.
      boolean preferUnassociatedRenderer =
          MimeTypes.getTrackType(group.getFormat(0).sampleMimeType) == C.TRACK_TYPE_METADATA;
      int rendererIndex =
          findRenderer(
              rendererCapabilities, group, rendererTrackGroupCounts, preferUnassociatedRenderer);
      // Evaluate the support that the renderer provides for each track in the group.
      @Capabilities
      int[] rendererFormatSupport =
          rendererIndex == rendererCapabilities.length
              ? new int[group.length]
              : getFormatSupport(rendererCapabilities[rendererIndex], group);
      // Stash the results.
      int rendererTrackGroupCount = rendererTrackGroupCounts[rendererIndex];
      rendererTrackGroups[rendererIndex][rendererTrackGroupCount] = group;
      rendererFormatSupports[rendererIndex][rendererTrackGroupCount] = rendererFormatSupport;
      rendererTrackGroupCounts[rendererIndex]++;
    }

here only one AudioRender will be enable.

louiewh avatar Jul 21 '22 11:07 louiewh

Playing two audio tracks at the same time requires having multiple audio renderers I think. This is far from trivial and is not something we can give you support for I'm afraid.

Best is probably picking up the comment you got in this issue.

I leave this open for a while in case someone from the community has some insights how to achieve this.

marcbaechinger avatar Jan 27 '23 11:01 marcbaechinger