When I rewrote the subtitle behavior I did test with media that had both embedded and external subtitles, and in those tests the server would always put all embedded tracks (including audio/video) before external tracks, keeping their indexes the same as you would find them sorted in when inspecting with ffprobe, mkvtoolnix and other tools.
However, this piece of shit API does not always do that. In fact, it can put the external tracks before internal tracks just for funs. This leaves a client literally unable to reliably map a media stream to tracks in their video engine. The hack I've implemented will take all the embedded/hls subtitle streams, filtering out everything else, and then calculate the index. Then does the same when selecting the ExoPlayer track. This should fix all the issues we've encountered (it does so for the media I tested with) but it's still unreliable because this will still fail if the server decided to fuck up the order of these tracks too.
Changes
Rewrite subtitle track matching for embedded/hls subtitle tracks to calculate the actual index locally
When I rewrote the subtitle behavior I did test with media that had both embedded and external subtitles, and in those tests the server would always put all embedded tracks (including audio/video) before external tracks, keeping their indexes the same as you would find them sorted in when inspecting with ffprobe, mkvtoolnix and other tools.
However, this piece of shit API does not always do that. In fact, it can put the external tracks before internal tracks just for funs. This leaves a client literally unable to reliably map a media stream to tracks in their video engine. The hack I've implemented will take all the embedded/hls subtitle streams, filtering out everything else, and then calculate the index. Then does the same when selecting the ExoPlayer track. This should fix all the issues we've encountered (it does so for the media I tested with) but it's still unreliable because this will still fail if the server decided to fuck up the order of these tracks too.
Changes
Issues
Fixes #4183 Maybe fixes #4182