Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Search instead for 
Did you mean: 

Subtitles in RoVideoScreen in case of Audio

I am trying to implement subtitles on RoVideoScreen when playing an Audio file.But When i try to play Subtitle ,I didnt see any subtitles.Is their is any other way so that we can show subtitles on RoVideoScreen in case of audio


Function displayVideo(itemIndex as Integer, json As Object,onSubtitle as Integer,isResumePosition As String,index As Integer)
print "display video started"

displayType = getDisPlayType()

p = CreateObject("roMessagePort")
video = CreateObject("roVideoScreen")
video.setMessagePort(p)
videoclip = CreateObject("roAssociativeArray")
'StreamBitrates = [384, 500, 1000, 1500]
'StreamBitrates = [1500]
StreamUrls = CreateObject("roList")
StreamQualities = CreateObject("roList")
StreamStickyHttpRedirects = CreateObject("roList")
StreamBitrates = getAllBitrate(json.destinationContent[index].video[itemIndex].videoUrl)

For Each bitrate In StreamBitrates
StreamUrls.AddTail(json.destinationContent[index].video[itemIndex].videoUrl)
StreamStickyHttpRedirects.AddTail(true)
if bitrate < 1125
StreamQualities.AddTail("SD")
else
StreamQualities.AddTail("HD")
end if
End For

videoclip.StreamUrls = StreamUrls
videoclip.StreamBitrates = StreamBitrates
videoclip.StreamQualities = StreamQualities
videoclip.StreamStickyHttpRedirects = StreamStickyHttpRedirects

videoclip.Title = json.destinationContent[index].video[itemIndex].title
videoclip.StreamFormat = "hls"

videoclip.HDBranded = true
videoclip.Length = json.destinationContent[index].video[itemIndex].Duration



'if json.video[itemIndex].srtFileUrl.count() <> 0 and onSubtitle=0
end if
video.SetPositionNotificationPeriod(2)
video.SetContent(videoclip)

if isResumePosition = "true"
nowpos=getPlaybackTime(videoclip.Title)
else if isResumePosition = "false"
nowpos=0
endif
video.show()
lastSavedPos = 0
flag=1
statusInterval = 10
while true
msg = wait(0, video.GetMessagePort())
if type(msg) = "roVideoScreenEvent"
if msg.isScreenClosed() then
setPlaybackTime(videoclip.Title,nowpos)
exit while
else if msg.isStreamStarted() then
print "info= ";msg.GetInfo()
if flag=1
video.Seek(1000*nowpos)
flag=0
End if
else if msg.isStreamSegmentInfo() then
info=msg.GetInfo()
print "isStreamSegmentInfo = ";info
else if msg.isPartialResult() then
setPlaybackTime(videoclip.Title,nowpos)
else if msg.isFullResult() then
deleteLastPlay(videoclip.Title)
nowpos = 0
else if msg.isPlaybackPosition() then
nowpos = msg.GetIndex()
print "Current Posintion is ";nowpos
if nowpos > 10000

end if
if nowpos > 0
if abs(nowpos - lastSavedPos) > statusInterval
lastSavedPos = nowpos
end if
end if
else if msg.isRequestFailed()
print "play failed: "; msg.GetMessage()
else
print "Unknown event: "; msg.GetType(); " msg: "; msg.GetMessage()
if msg.GetType()=15

print "Video ended "
End if
endif
end if
end while
print "display video end"
End Function




0 Kudos