Your Digital Media Has Never Looked So Good

 
gooky
Topic Author
Posts: 3
Joined: Tue Oct 04, 2016 1:44 pm

How to change subtitles during playback

Wed Oct 05, 2016 2:58 pm

Hi,

I want the user to be able to choose between different subtitles, I use the code below. However any changes are not applied to the movie. 

What am i doing wrong?

sub init()
 movieNode = CreateObject("roSGNode", "ContentNode")
movieNode.Title = "Movie name"

movieNode.StreamFormat = "mp4"
movieNode.URL = "http://187.188.137.31/test.m4v"
movieNode.SubtitleTracks = [{ TrackName: "http://187.188.137.31/latin.srt", Language:"spa", Description:"Spanish" }, { TrackName: "http://187.188.137.31/english.srt", Language:"eng", Description:"English" }]

m.player = m.top.findNode("player")
m.player.content = movieNode
m.player.control = "play"
m.player.setFocus(true)

end sub
 
adrianc1982
Posts: 89
Joined: Thu Jun 05, 2014 6:02 pm

Re: How to change subtitles during playback

Wed Oct 05, 2016 6:39 pm

im still coding my app in scene graph so i havent gotten to video playback as im building my menus en ui

but according to what i read from the docs you should call m.player.globalCaptionMode("On"). By default captions is "Off"


Subtitles may or may not be visible on the screen, depending upon the user's caption setting. Reading this field will return the identifier of the current subtitle track, and setting the field will change the track.



you can learn more at

https://sdkdocs.roku.com/display/sdkdoc/Video#Video-Fields
 
gooky
Topic Author
Posts: 3
Joined: Tue Oct 04, 2016 1:44 pm

Re: How to change subtitles during playback

Thu Oct 06, 2016 7:56 am

You are correct, one needs to make sure that it is on, however in my sandbox the captions are on by default, so this is not the problem right now :-)

Did I forget to mention... if I write the following:
movieNode.SubtitleConfig = { TrackName: "http://187.188.137.31/latin.srt" }



the movie starts with latin subtitles. However, changing the subtitle to English in closed caption dialog, it continues to show latin and not English as expected.
It seems like a bug, because I can observe the field subtitleTrack on the player and it actually changes when changing subtitles in closed caption dialog. However no request is made to the server, thus no change of subtitle :-(
 
adrianc1982
Posts: 89
Joined: Thu Jun 05, 2014 6:02 pm

Re: How to change subtitles during playback

Sat Oct 08, 2016 4:25 pm

you could try to disable close caption setting the english subs and then enabling captions.
 
tifroz
Posts: 29
Joined: Sun May 29, 2016 4:08 pm

Re: How to change subtitles during playback

Mon May 06, 2019 2:11 pm

Did you ever figure it out? Would appreciate the solution as I am experiencing the same behavior!
 
gomad
Posts: 57
Joined: Wed Nov 29, 2017 4:07 am

Re: How to change subtitles during playback

Wed May 08, 2019 3:19 am

what stream are u using? the above code works with HLS streams for me, DASH we are also having issues with the same code, same behaviour. 
So according to their documentation:
In the 8.0 firmware, automatic track selection based on a preferred caption language setting is introduced. Omit setting a URL here to avoid interfering with the automatic track selection. It is sufficient to add the URLs to SubtitleTracks.
so u dont have to set the configSubtitle but just the  SubtitleTracks with an AA.

Who is online

Users browsing this forum: No registered users and 4 guests