TheWidlarzGroup / react-native-video

A <Video /> component for react-native
https://thewidlarzgroup.github.io/react-native-video/
MIT License
7.19k stars 2.9k forks source link

VideoTracks selection #3312

Open gizomo opened 1 year ago

gizomo commented 1 year ago

1) Class VideoTrack has both 'id' and 'trackId' fields. And 'id' is permanently set to -1. Function 'videoTracksToArray' of VideoEventEmmiter uses 'id' from VideoTrack as 'trackId'. So all video-tracks at JS side have only 'trackId' field and it is always set to -1.

2) Function 'exoplayerVideoTrackToGenericVideoTrack' takes trackIndex and if format.id is null it set trackIndex to 'trackId' field of VideoTrack. But trackIndex is the index of videoFormat withing TrackGroup. I think it is wrong because 'trackId' will not be unique in that case.

3) You should use String.valueOf(format.id) because VideoTrack.trackId is string and JS receives undefined if you try set number.

4) Actually VideoTrack.trackId is useless because it is not used anywhere. And selecting video track by type 'index' actually selects TrackGroup but not tracks in that group. So its impossible to select video-track by 'index' now for single video trackGroup. And in case of several video trackGroups selection by 'index' is not obvious at all as it selects the group, not a specific track. It may be preferable to assign a absolute index for video-tracks or just use the 'trackId' composed from index of TrackGroup and index of videoFormat in that group.

freeboub commented 1 year ago

Looks like you already fixed these issues. A PR would be welcome! Thank you

gizomo commented 1 year ago

As for 4. I'm not sure how it should work and be compatible with the AVPlay.

I found android description of track group and it says:

As an example of how tracks can be grouped, consider an adaptive playback where a main video feed is provided in five resolutions, and an alternative video feed (e.g., a different camera angle in a sports match) is provided in two resolutions. In this case there will be two video track groups, one corresponding to the main video feed containing five tracks, and a second for the alternative video feed containing two tracks.

Note that audio tracks whose languages differ are not grouped, because content in different languages is not considered to be the same. Conversely, audio tracks in the same language that only differ in properties such as bitrate, sampling rate, channel count and so on can be grouped. This also applies to text tracks.

So video tracks can be grouped on some abstract criteria (different camera angle for example). In this case, when selecting the track by index, we change the 'camera' tracks, not the video quality. So we can change video quality with several video groups only if video tracks are grouped by resolution for example.

In most cases I assume video tracks belong to the same group such as in this playlist

#EXTM3U
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=688301
http://qthttp.apple.com.edgesuite.net/1010qwoeiuryfg/0640_vod.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=165135
http://qthttp.apple.com.edgesuite.net/1010qwoeiuryfg/0150_vod.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=262346
http://qthttp.apple.com.edgesuite.net/1010qwoeiuryfg/0240_vod.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=481677
http://qthttp.apple.com.edgesuite.net/1010qwoeiuryfg/0440_vod.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=1308077
http://qthttp.apple.com.edgesuite.net/1010qwoeiuryfg/1240_vod.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=1927853
http://qthttp.apple.com.edgesuite.net/1010qwoeiuryfg/1840_vod.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=2650941
http://qthttp.apple.com.edgesuite.net/1010qwoeiuryfg/2540_vod.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=3477293
http://qthttp.apple.com.edgesuite.net/1010qwoeiuryfg/3340_vod.m3u8

Also there are more complicated cases such as in this playlist

#EXTM3U
#EXT-X-VERSION:7
#EXT-X-INDEPENDENT-SEGMENTS

#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=6303166,BANDWIDTH=11265828,CODECS="avc1.640028,ec-3",RESOLUTION=1920x1080,FRAME-RATE=25.000,SUBTITLES="subs-ec3-20",CLOSED-CAPTIONS=NONE,AUDIO="ec3_stereo"
video_6000k/prog_index.m3u8
#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=4750392,BANDWIDTH=7979513,CODECS="avc1.640028,ec-3",RESOLUTION=1920x1080,FRAME-RATE=25.000,SUBTITLES="subs-ec3-20",CLOSED-CAPTIONS=NONE,AUDIO="ec3_stereo"
video_4500k/prog_index.m3u8
#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=3202998,BANDWIDTH=5134820,CODECS="avc1.4d001f,ec-3",RESOLUTION=1280x720,FRAME-RATE=25.000,SUBTITLES="subs-ec3-20",CLOSED-CAPTIONS=NONE,AUDIO="ec3_stereo"
video_3000k/prog_index.m3u8
#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=2196234,BANDWIDTH=3305648,CODECS="avc1.4d001f,ec-3",RESOLUTION=960x540,FRAME-RATE=25.000,SUBTITLES="subs-ec3-20",CLOSED-CAPTIONS=NONE,AUDIO="ec3_stereo"
video_2000k/prog_index.m3u8
#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=1259726,BANDWIDTH=1918208,CODECS="avc1.4d001e,ec-3",RESOLUTION=768x432,FRAME-RATE=25.000,SUBTITLES="subs-ec3-20",CLOSED-CAPTIONS=NONE,AUDIO="ec3_stereo"
video_1000k/prog_index.m3u8
#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=884732,BANDWIDTH=1270234,CODECS="avc1.42001e,ec-3",RESOLUTION=640x360,FRAME-RATE=25.000,SUBTITLES="subs-ec3-20",CLOSED-CAPTIONS=NONE,AUDIO="ec3_stereo"
video_730k/prog_index.m3u8
#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=503255,BANDWIDTH=669126,CODECS="avc1.42e015,ec-3",RESOLUTION=480x270,FRAME-RATE=25.000,SUBTITLES="subs-ec3-20",CLOSED-CAPTIONS=NONE,AUDIO="ec3_stereo"
video_365k/prog_index.m3u8
#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=229236,BANDWIDTH=271811,CODECS="avc1.42e00b,ec-3",RESOLUTION=416x234,FRAME-RATE=4.000,SUBTITLES="subs-ec3-20",CLOSED-CAPTIONS=NONE,AUDIO="ec3_stereo"
video_192k/prog_index.m3u8

#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=6305791,BANDWIDTH=11204864,CODECS="avc1.640028,mp4a.40.2",RESOLUTION=1920x1080,FRAME-RATE=25.000,SUBTITLES="subs-aac",CLOSED-CAPTIONS=NONE,AUDIO="aac"
video_6000k/prog_index.m3u8
#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=4753017,BANDWIDTH=7981552,CODECS="avc1.640028,mp4a.40.2",RESOLUTION=1920x1080,FRAME-RATE=25.000,SUBTITLES="subs-aac",CLOSED-CAPTIONS=NONE,AUDIO="aac"
video_4500k/prog_index.m3u8
#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=3205623,BANDWIDTH=5137859,CODECS="avc1.4d001f,mp4a.40.2",RESOLUTION=1280x720,FRAME-RATE=25.000,SUBTITLES="subs-aac",CLOSED-CAPTIONS=NONE,AUDIO="aac"
video_3000k/prog_index.m3u8
#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=2198859,BANDWIDTH=3308768,CODECS="avc1.4d001f,mp4a.40.2",RESOLUTION=960x540,FRAME-RATE=25.000,SUBTITLES="subs-aac",CLOSED-CAPTIONS=NONE,AUDIO="aac"
video_2000k/prog_index.m3u8
#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=1262351,BANDWIDTH=1921247,CODECS="avc1.4d001e,mp4a.40.2",RESOLUTION=768x432,FRAME-RATE=25.000,SUBTITLES="subs-aac",CLOSED-CAPTIONS=NONE,AUDIO="aac"
video_1000k/prog_index.m3u8
#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=887357,BANDWIDTH=1273273,CODECS="avc1.42001e,mp4a.40.2",RESOLUTION=640x360,FRAME-RATE=25.000,SUBTITLES="subs-aac",CLOSED-CAPTIONS=NONE,AUDIO="aac"
video_730k/prog_index.m3u8
#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=505880,BANDWIDTH=672165,CODECS="avc1.42e015,mp4a.40.2",RESOLUTION=480x270,FRAME-RATE=25.000,SUBTITLES="subs-aac",CLOSED-CAPTIONS=NONE,AUDIO="aac"
video_365k/prog_index.m3u8
#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=231861,BANDWIDTH=274850,CODECS="avc1.42e00b,mp4a.40.2",RESOLUTION=416x234,FRAME-RATE=4.000,SUBTITLES="subs-aac",CLOSED-CAPTIONS=NONE,AUDIO="aac"
video_192k/prog_index.m3u8

#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=6367166,BANDWIDTH=11265828,CODECS="avc1.640028,ec-3",RESOLUTION=1920x1080,FRAME-RATE=25.000,SUBTITLES="subs-ec3-51",CLOSED-CAPTIONS=NONE,AUDIO="ec3"
video_6000k/prog_index.m3u8
#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=4814392,BANDWIDTH=8042516,CODECS="avc1.640028,ec-3",RESOLUTION=1920x1080,FRAME-RATE=25.000,SUBTITLES="subs-ec3-51",CLOSED-CAPTIONS=NONE,AUDIO="ec3"
video_4500k/prog_index.m3u8
#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=3266998,BANDWIDTH=5198823,CODECS="avc1.4d001f,ec-3",RESOLUTION=1280x720,FRAME-RATE=25.000,SUBTITLES="subs-ec3-51",CLOSED-CAPTIONS=NONE,AUDIO="ec3"
video_3000k/prog_index.m3u8
#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=2260234,BANDWIDTH=3369651,CODECS="avc1.4d001f,ec-3",RESOLUTION=960x540,FRAME-RATE=25.000,SUBTITLES="subs-ec3-51",CLOSED-CAPTIONS=NONE,AUDIO="ec3"
video_2000k/prog_index.m3u8
#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=1332726,BANDWIDTH=1982211,CODECS="avc1.4d001e,ec-3",RESOLUTION=768x432,FRAME-RATE=25.000,SUBTITLES="subs-ec3-51",CLOSED-CAPTIONS=NONE,AUDIO="ec3"
video_1000k/prog_index.m3u8
#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=948732,BANDWIDTH=1334237,CODECS="avc1.42001e,ec-3",RESOLUTION=640x360,FRAME-RATE=25.000,SUBTITLES="subs-ec3-51",CLOSED-CAPTIONS=NONE,AUDIO="ec3"
video_730k/prog_index.m3u8
#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=567255,BANDWIDTH=733129,CODECS="avc1.42e015,ec-3",RESOLUTION=480x270,FRAME-RATE=25.000,SUBTITLES="subs-ec3-51",CLOSED-CAPTIONS=NONE,AUDIO="ec3"
video_365k/prog_index.m3u8
#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=293236,BANDWIDTH=335814,CODECS="avc1.42e00b,ec-3",RESOLUTION=416x234,FRAME-RATE=4.000,SUBTITLES="subs-ec3-51",CLOSED-CAPTIONS=NONE,AUDIO="ec3"
video_192k/prog_index.m3u8

#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=6559166,BANDWIDTH=11457828,CODECS="avc1.640028,ac-3",RESOLUTION=1920x1080,FRAME-RATE=25.000,SUBTITLES="subs-ac3",CLOSED-CAPTIONS=NONE,AUDIO="ac3"
video_6000k/prog_index.m3u8
#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=5006392,BANDWIDTH=8234516,CODECS="avc1.640028,ac-3",RESOLUTION=1920x1080,FRAME-RATE=25.000,SUBTITLES="subs-ac3",CLOSED-CAPTIONS=NONE,AUDIO="ac3"
video_4500k/prog_index.m3u8
#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=3458998,BANDWIDTH=5390823,CODECS="avc1.4d001f,ac-3",RESOLUTION=1280x720,FRAME-RATE=25.000,SUBTITLES="subs-ac3",CLOSED-CAPTIONS=NONE,AUDIO="ac3"
video_3000k/prog_index.m3u8
#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=2452234,BANDWIDTH=3561651,CODECS="avc1.4d001f,ac-3",RESOLUTION=960x540,FRAME-RATE=25.000,SUBTITLES="subs-ac3",CLOSED-CAPTIONS=NONE,AUDIO="ac3"
video_2000k/prog_index.m3u8
#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=1515726,BANDWIDTH=2174211,CODECS="avc1.4d001e,ac-3",RESOLUTION=768x432,FRAME-RATE=25.000,SUBTITLES="subs-ac3",CLOSED-CAPTIONS=NONE,AUDIO="ac3"
video_1000k/prog_index.m3u8
#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=1140732,BANDWIDTH=1526237,CODECS="avc1.42001e,ac-3",RESOLUTION=640x360,FRAME-RATE=25.000,SUBTITLES="subs-ac3",CLOSED-CAPTIONS=NONE,AUDIO="ac3"
video_730k/prog_index.m3u8
#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=759255,BANDWIDTH=925129,CODECS="avc1.42e015,ac-3",RESOLUTION=480x270,FRAME-RATE=25.000,SUBTITLES="subs-ac3",CLOSED-CAPTIONS=NONE,AUDIO="ac3"
video_365k/prog_index.m3u8
#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=485236,BANDWIDTH=527814,CODECS="avc1.42e00b,ac-3",RESOLUTION=416x234,FRAME-RATE=4.000,SUBTITLES="subs-ac3",CLOSED-CAPTIONS=NONE,AUDIO="ac3"
video_192k/prog_index.m3u8

#EXT-X-I-FRAME-STREAM-INF:AVERAGE-BANDWIDTH=427577,BANDWIDTH=1673200,CODECS="avc1.640028",RESOLUTION=1920x1080,URI="video_6000k/iframe_index.m3u8"
#EXT-X-I-FRAME-STREAM-INF:AVERAGE-BANDWIDTH=339923,BANDWIDTH=1304431,CODECS="avc1.640028",RESOLUTION=1920x1080,URI="video_4500k/iframe_index.m3u8"
#EXT-X-I-FRAME-STREAM-INF:AVERAGE-BANDWIDTH=250827,BANDWIDTH=973262,CODECS="avc1.4d001f",RESOLUTION=1280x720,URI="video_3000k/iframe_index.m3u8"
#EXT-X-I-FRAME-STREAM-INF:AVERAGE-BANDWIDTH=172544,BANDWIDTH=620400,CODECS="avc1.4d001f",RESOLUTION=960x540,URI="video_2000k/iframe_index.m3u8"
#EXT-X-I-FRAME-STREAM-INF:AVERAGE-BANDWIDTH=107738,BANDWIDTH=397693,CODECS="avc1.4d001e",RESOLUTION=768x432,URI="video_1000k/iframe_index.m3u8"
#EXT-X-I-FRAME-STREAM-INF:AVERAGE-BANDWIDTH=69062,BANDWIDTH=228493,CODECS="avc1.42001e",RESOLUTION=640x360,URI="video_730k/iframe_index.m3u8"
#EXT-X-I-FRAME-STREAM-INF:AVERAGE-BANDWIDTH=59513,BANDWIDTH=157562,CODECS="avc1.42e015",RESOLUTION=480x270,URI="video_365k/iframe_index.m3u8"
#EXT-X-I-FRAME-STREAM-INF:AVERAGE-BANDWIDTH=39939,BANDWIDTH=81968,CODECS="avc1.42e00b",RESOLUTION=416x234,URI="video_192k/iframe_index.m3u8"

#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="ec3",NAME="English",LANGUAGE="en",DEFAULT=YES,AUTOSELECT=YES,CHANNELS="6",URI="audio_ddp_51_eng/prog_index.m3u8"
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="ec3",NAME="Español",LANGUAGE="es",DEFAULT=NO,AUTOSELECT=YES,CHANNELS="6",URI="audio_ddp_51_spa/prog_index.m3u8"
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="ec3",NAME="中文",LANGUAGE="zh",DEFAULT=NO,AUTOSELECT=YES,CHANNELS="6",URI="audio_ddp_51_chi/prog_index.m3u8"

#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="ac3",NAME="English",LANGUAGE="en",DEFAULT=YES,AUTOSELECT=YES,CHANNELS="6",URI="audio_dd_51_eng/prog_index.m3u8"
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="ac3",NAME="Español",LANGUAGE="es",DEFAULT=NO,AUTOSELECT=YES,CHANNELS="6",URI="audio_dd_51_spa/prog_index.m3u8"
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="ac3",NAME="中文",LANGUAGE="zh",DEFAULT=NO,AUTOSELECT=YES,CHANNELS="6",URI="audio_dd_51_chi/prog_index.m3u8"

#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="ec3_stereo",NAME="English",LANGUAGE="en",DEFAULT=YES,AUTOSELECT=YES,CHANNELS="2",URI="audio_ddp_2ch_eng/prog_index.m3u8"
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="ec3_stereo",NAME="Español",LANGUAGE="es",DEFAULT=NO,AUTOSELECT=YES,CHANNELS="2",URI="audio_ddp_2ch_spa/prog_index.m3u8"
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="ec3_stereo",NAME="中文",LANGUAGE="zh",DEFAULT=NO,AUTOSELECT=YES,CHANNELS="2",URI="audio_ddp_2ch_chi/prog_index.m3u8"

#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac",NAME="English",LANGUAGE="en",DEFAULT=YES,AUTOSELECT=YES,CHANNELS="2",URI="audio_aac_2ch_eng/prog_index.m3u8"
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac",NAME="Español",LANGUAGE="es",DEFAULT=NO,AUTOSELECT=YES,CHANNELS="2",URI="audio_aac_2ch_spa/prog_index.m3u8"
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac",NAME="中文",LANGUAGE="zh",DEFAULT=NO,AUTOSELECT=YES,CHANNELS="2",URI="audio_aac_2ch_chi/prog_index.m3u8"

#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs-ec3-20",NAME="English",DEFAULT=YES,AUTOSELECT=YES,FORCED=NO,LANGUAGE="eng",URI="subtitles/ec3_20_eng/subs.m3u8"
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs-ec3-20",NAME="中文",DEFAULT=NO,AUTOSELECT=YES,FORCED=NO,LANGUAGE="chi",URI="subtitles/ec3_20_eng/subs.m3u8"
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs-ec3-20",NAME="Español",DEFAULT=NO,AUTOSELECT=YES,FORCED=NO,LANGUAGE="spa",URI="subtitles/ec3_20_eng/subs.m3u8"

#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs-aac",NAME="English",DEFAULT=YES,AUTOSELECT=YES,FORCED=NO,LANGUAGE="eng",URI="subtitles/aac_eng/subs.m3u8"
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs-aac",NAME="中文",DEFAULT=NO,AUTOSELECT=YES,FORCED=NO,LANGUAGE="chi",URI="subtitles/aac_eng/subs.m3u8"
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs-aac",NAME="Español",DEFAULT=NO,AUTOSELECT=YES,FORCED=NO,LANGUAGE="spa",URI="subtitles/aac_eng/subs.m3u8"

#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs-ec3-51",NAME="English",DEFAULT=YES,AUTOSELECT=YES,FORCED=NO,LANGUAGE="eng",URI="subtitles/ec3_51_eng/subs.m3u8"
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs-ec3-51",NAME="中文",DEFAULT=NO,AUTOSELECT=YES,FORCED=NO,LANGUAGE="chi",URI="subtitles/ec3_51_eng/subs.m3u8"
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs-ec3-51",NAME="Español",DEFAULT=NO,AUTOSELECT=YES,FORCED=NO,LANGUAGE="spa",URI="subtitles/ec3_51_eng/subs.m3u8"

#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs-ac3",NAME="English",DEFAULT=YES,AUTOSELECT=YES,FORCED=NO,LANGUAGE="eng",URI="subtitles/ac3_51_eng/subs.m3u8"
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs-ac3",NAME="中文",DEFAULT=NO,AUTOSELECT=YES,FORCED=NO,LANGUAGE="chi",URI="subtitles/ac3_51_eng/subs.m3u8"
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs-ac3",NAME="Español",DEFAULT=NO,AUTOSELECT=YES,FORCED=NO,LANGUAGE="spa",URI="subtitles/ac3_51_eng/subs.m3u8"

For this playlist MappingTrackSelector has video GroupTrackArray with only single GroupTrack. And this GroupTrack has 16 video tracks (8 main video tracks and 8 video tracks for trick play)

gizomo commented 1 year ago

After delving into the topic, I came to the conclusion that support for several video groups was not implemented. The latest discussions were already within issue #2600 a long time ago.

Therefore, in my implementation of choosing video tracks, I decided to start from the following conditions:

  1. Always assume that there is always one group of video tracks
  2. If video tracks are selected by id (index), then select a specific track.
  3. Video track selection by resolution can include all tracks with close or exact matching resolution for adaptive selection.

Also, after studying examples of playlists and how exoplayer parses them and then groups the tracks, a number of conclusions can be drawn.

  1. As described in the documentation for exoplayer, audio tracks are grouped by language and if their bitrates, mime-type and number of channels do not match.
  2. If the audio track has the same lanuage as well as other parameters, then most likely this track will fall into a separate 'alternative' group.
  3. The first group of audio and video tracks is always named by exoplayer as the 'main', and the indices of this group are used as ids.
  4. In other groups of audio tracks, the ids are composite: group id+ track label.
  5. Despite the mention in the exoplayer documentation about the possibility of grouping subtitles, they were not grouped in any of the playlists I tested. The groups count coincided with the subtitles count. Those each subtitle is placed in its own separate group, even if it has the same language as other subtitles.
  6. Taking into account 2 and 5, I suppose that selecting subtitles and audio tracks by language may not work in some cases.
  7. As a result, the conclusion suggests itself that the most adequate choice for audio tracks and subtitles would be to select by index. In this case, the indices will refer to groups of tracks. Also it is necessary for grouped audio tracks to check codec support in order to exclude unsupported tracks.
github-actions[bot] commented 2 weeks ago

This issue is stale because it has been open for 30 days with no activity. If there won't be any activity in the next 14 days, this issue will be closed automatically.