I've encountered a problem while playing videos. Whenever I switch the subtitles, the video suddenly stops. I'm using the following code to change the subtitle URL for m.videoPlayer: content.subtitleConfig = { trackName: captionURL }. Surprisingly, the logs show that the video is still in the playing state, and the URL seems to be correct.
I wanted to see if anyone has experienced a similar issue or has any insights into what might be causing this problem. It's worth mentioning that the backend response's manifest </AdaptationSet> contains multiple subtitles, and I have attempted to use the subtitleTracks option in the API.
and I aslo tried using subtitleTrack, but the terminal displays an error stating that it is a nonexistent field (even though I have added this field in the VideoPlayerContentNode).
Your assistance or suggestions would be greatly appreciated. Thank you in advance for your help!
I don't think you can change that on the fly. It's something you set up before starting the video. If you have multiple subtitles you should be adding them to the SubtitleTracks property of the ContentNode's content metadata so the UI can handle them when the user presses *.
https://developer.roku.com/docs/developer-program/getting-started/architecture/content-metadata.md
Since my closed caption and language are a custom UI, I have set up the SubtitleTracks before playing the startup video. However, regarding allowing users to change the subtitles during video playback. What code changes do I need to make in order to enable subtitle switching when the user clicks on it?
You shouldn't have to do anything. The configured subtitle options should show up under "Captioning track" under "Accessibility & captions" when the user presses *. I have to admit that I've only ever had one captioning track for my own videos, but that's how it's supposed to work.