Search code examples
rokubrightscript

How to Displayed cc(subtitle) in Roku?


I use XML attribute URL for playing a video. And I used By default media player in Roku. I know Roku is provided By default option to display a subtitle. In the video I played in VLC Media Player there provided to CC. But any separate code required for display a subtitle or CC in Roku?

I tried this way EDITED POST:

m.liveVideo = m.top.findNode("liveVideo") '<Video id = "liveVideo" />
m.videoData = CreateObject("RoSGNode", "ContentNode")
m.videoData.SubtitleConfig = {
        trackName: "eia608/708"
}
m.videoData.ClosedCaptions = "true"
m.liveVideo.content = m.videoData

But above code doesn't work.


Solution

  • You're missing the SubtitleTracks property and the standard for live streams is usually "eia608/1" (See here). Also, don't worry about the ClosedCaptions property, is true by default.

    Here's how you should construct the subtitleTracks field:

    m.liveVideo = m.top.findNode("liveVideo")
    m.videoData = CreateObject("roSGNode", "ContentNode")
    m.videoData.subtitleTracks = [{language: "EN", description: "EN", trackName: "eia608/1"}]
    m.videoData.subtitleConfig = {trackName: "eia608/1"}
    m.liveVideo.content = m.videoData