I'm trying to get subtitles working when there are multiple subtitle tracks placed in the content-metadata's 'SubtitleTracks' field, and switching between them using the video node's 'SubtitleTrack' field.
Problem 1: setting 'SubtitleTrack' while the video's 'control' state is 'pause', nothing happens.
When paused, if the subtitle track is changed, the video keeps showing the previously selected subtitles after resuming. Strangely if I query the video node's 'CurrentSubtitleTrack' it returns the expected value. If I do the same thing while the video is playing, it correctly switches the subtitle track (for mkv/ subs anyway, see below).
Problem 2: switching to a different 'http://...' subtitle track
I can never seem to switch to an http subtitle track, unless it is the first in the 'SubtitleTracks' list and enabled by default. This also applies to 'pkg:' subtitles. The first subtitle track in the list gets enabled by default, but can't be changed. 'SubtitleTrack' contains the new value, but 'CurrentSubtitleTrack' keeps the old value.
videoContent.SubtitleTracks = [
{TrackName: "http://etcetc/sub1.srt", Language: "eng", Description: "HTTP track"},
{TrackName: "http://etcetc/sub2.srt", Language: "eng", Description: "HTTP track"}
]
THEN
'subs1 is active as expected
'videoNode.CurrentSubtitleTrack contains "http://etcetc/sub1.srt" as expected
videoNode.SubtitleTrack = "http://etcetc/sub2.srt" ' Does nothing
'subs1 is still active
'videoNode.CurrentSubtitleTrack still contains "http://etcetc/sub1.srt" (even after waiting a bit)
Problem 3: mixing subtitle types 'mkv/...' and 'http://...'
If I put only a single sideloaded srt http entry in 'SubtitleTracks', that track plays fine. But if I try to switch to any of the 'mkv/' subtitles nothing happens (although 'CurrentSubtitleTrack' contains the correct value). The same happens if I append 'mkv/' entries after the http entry. The same also happens if I use a 'pkg:' entry in place of http.
videoContent.SubtitleTracks = [ {TrackName: "http://etcetc/sub.srt", Language: "eng", Description: "HTTP track"} ]
OR
videoContent.SubtitleTracks = [
{TrackName: "pkg:/files/sub.srt", Language: "eng", Description: "PKG track"}
] OR videoContent.SubtitleTracks = [ {TrackName: "http://etcetc/sub.srt", Language: "eng", Description: "HTTP track"}, {TrackName: "mkv/3", Language: "eng", Description: "First embedded mkv subtitle track"}, {TrackName: "mkv/4", Language: "eng", Description: "Second embedded mkv subtitle track"} ] THEN
'http://etcetc/sub.srt is active by default videoNode.SubtitleTrack = "mkv/3" ' Doesn't work, sub.srt still active
'videoNode.CurrentSubtitleTrack contains "mkv/3" even though it's not displayed
However if I place the 'mkv/' entries BEFORE the http entry, the mkv subtitles work and can be switched between, but the http or pkg track doesn't work. And in this case, 'CurrentSubtitleTrack' does NOT return the expected http value (it remains on the old mkv value).
I've noticed that in 'AvailableSubtitleTracks' the http entry's TrackName has something like '<dev_d96_26>' prepended, and I've also tried using that full value which also fails.
videoContent.SubtitleTracks = [ {TrackName: "mkv/3", Language: "eng", Description: "First embedded mkv subtitle track"}, {TrackName: "mkv/4", Language: "eng", Description: "Second embedded mkv subtitle track"}, {TrackName: "http://etcetc/sub.srt", Language: "eng", Description: "HTTP track"},
{TrackName: "pkg:/files/sub.srt", Language: "eng", Description: "PKG track"} ] THEN
'mkv/3 is active by default videoNode.SubtitleTrack = "mkv/4" ' Works! mkv/4 is active videoNode.SubtitleTrack = "mkv/3" ' Works! mkv/3 is active again videoNode.SubtitleTrack = "http://etcetc/sub.srt" ' Fails, mkv/3 still active
videoNode.SubtitleTrack = "pkg:/files/sub.srt" ' Fails
videoNode.SubtitleTrack = "<dev_d96_26>http://etcetc/sub.srt" ' Fails
'videoNode.CurrentSubtitleTrack still contains "mkv/3"
So, what am I doing wrong here? I feel like I must be missing something. I suppose a workaround might be to fully re-load the video when changing subtitles, with only 1 subtitle type ever specified in the video content metadata. Though I'd prefer to not have to resort to that.
After some more investigation it looks like the problems center around the embedded mkv subtitles. Setting the external subtitles does work, but I do need to first lookup the matching TrackName specified in 'availableSubtitleTracks'. I'm not sure why I thought that was failing before. It also seems to work when paused.
For the mkv subtitles, they kind of work as long as I never activate an external subtitle track. I can flip between them (as long as the player isn't paused, that still fails). But if I ever activate an external subtitle track, the mkv ones won't work anymore. Even though 'currentSubtitleTrack' does get updated, the previously selected external subtitles keep getting shown instead of the mkv subs.