Forum Discussion

Anonymous's avatar
Anonymous
12 months ago

Subtitles are out of sync after track change

Hello everyone! I am working on my channel with custom videoplayer (video node is a child of my ui screen). And I am constantly facing a problem with subtitles. I have an hls format stream and when I enable imbedded subtitle tracks (setting subtitleTrack field of Video node and globalCaptionMode to "On") - everything works fine. But sometimes when I try to change subtitleTrack to select other language, it causes player to buffer and after buffering is done subtitles start displaying from the very beginnig while video playback continues. This causes subtitles being out of sync after changing language. I've tried disabling globalCaptionMode before chaning track and then enabling it back, but it didn't work out. Any ideas will be highly appreciated as work on this problem for two weeks already and can't find the way out.

Here is the part of code i am using to select subtitles

 

sub setSubtitles()
    if m.SelectedSubtitles = "Off" 
        m.player.globalCaptionMode = "Off"
        return
    end if
    for each language in m.player.availableSubtitleTracks
        if UCase(language.language) = Ucase(m.SelectedSubtitles)
            m.player.subtitleTrack = language.TrackName
            if m.player.globalCaptionMode <> "On"
                m.player.globalCaptionMode = "On"
                exit for
            end if
        end if
    end for
end sub

 

No Replies