-
Notifications
You must be signed in to change notification settings - Fork 2
Description
When I try to play a non-default audio track (other language of a video file than what plays by default) the device always plays the default track anyway. I know this is likely not a cast-api issue, but perhaps you know some hint to solve it anyway.
What I'm doing: looked up info of the file via ffprobe -show_streams and configured audio tracks of the file's Media object accordingly:
Media.MediaBuilder mbl = Media.builder(url, "video/mp4", Media.StreamType.BUFFERED);
mbl = mbl.addTrack(new Track(null, // custom data
true, //inband
"en", "English",
null, // roles
null, // subtype, for text tracks only
null, // trackContentID url for non-inband tracks
null, // trackContentType mime type for non-inband tracks
0, Track.TrackType.VIDEO));
mbl = mbl.addTrack(new Track(null, // custom data
true, //inband
"de", "German",
null, // roles
null, // subtype, for text tracks only
null, // trackContentID url for non-inband tracks
null, // trackContentType mime type for non-inband tracks
1, Track.TrackType.AUDIO));
mbl = mbl.addTrack(new Track(null, // custom data
true, //inband
"en", "English",
null, // roles
null, // subtype, for text tracks only
null, // trackContentID url for non-inband tracks
null, // trackContentType mime type for non-inband tracks
2, Track.TrackType.AUDIO));
Media md = mbl.build();
List<Integer> tracks = List.of(0, 2);
MediaStatus mstat = se.load(md, tracks, true, 300.0, 1.0, true); AI told me I should remux to mp4 container, which I did with the same result. Audio is stereo aac, but the codec should not be the problem since the default track plays fine. Now the AI claims the likely issue is that track is chosen on load. It recommends to load without active tracks and wait a little (or asynchroneously for player state change), then set the wanted tracks. However I'm not sure how to do this with cast-api as is supports setting activeTracks only on load command. Perhaps the AI is suggesting nonsense anyway. I also tried to supply the mime info for each track but that did not change anything.
Did you ever succeed to select a secondary audio track in any way? How?