add audio channel count extractor

This commit is contained in:
chrisk325 2026-02-26 12:53:38 +05:30 committed by GitHub
parent 74bcc041af
commit b4dc7cdd88
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1599,6 +1599,11 @@ public class ReactExoplayerView extends FrameLayout implements
Track audioTrack = exoplayerTrackToGenericTrack(format, groupIndex, selection, group);
audioTrack.setBitrate(format.bitrate == Format.NO_VALUE ? 0 : format.bitrate);
audioTrack.setSelected(isSelected);
// Encode channel count into title so JS can read it e.g. "English|ch:6"
if (format.channelCount != Format.NO_VALUE && format.channelCount > 0) {
String existing = audioTrack.getTitle() != null ? audioTrack.getTitle() : "";
audioTrack.setTitle(existing + "|ch:" + format.channelCount);
}
audioTracks.add(audioTrack);
}
@ -1794,7 +1799,11 @@ public class ReactExoplayerView extends FrameLayout implements
Track track = new Track();
track.setIndex(groupIndex);
track.setLanguage(format.language != null ? format.language : "unknown");
track.setTitle(format.label != null ? format.label : "Track " + (groupIndex + 1));
String baseTitle = format.label != null ? format.label : "";
if (format.channelCount != Format.NO_VALUE && format.channelCount > 0) {
baseTitle = baseTitle + "|ch:" + format.channelCount;
}
track.setTitle(baseTitle);
track.setSelected(false); // Don't report selection status - let PlayerView handle it
if (format.sampleMimeType != null)
track.setMimeType(format.sampleMimeType);