Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
gokool
Visitor

roVideoScreen

Hi,
Is there are an example code for SetTimedMetaDataForKeys() usage in roVideoScreen/Player?

thanks.
0 Kudos
4 REPLIES 4
RokuJoel
Binge Watcher

Re: roVideoScreen

That feature (the ability to read ID3 tags in a stream) is only available on devices running 5.2 firmware, which, right now is only the brand new devices we just released, probably the end of the month or so for the rest of our non-legacy hardware.

I'll see if I can find some example code to post.

- Joel
0 Kudos
gokool
Visitor

Re: roVideoScreen

"RokuJoel" wrote:
That feature (the ability to read ID3 tags in a stream) is only available on devices running 5.2 firmware, which, right now is only the brand new devices we just released, probably the end of the month or so for the rest of our non-legacy hardware.

I'll see if I can find some example code to post.

- Joel



Thanks for the reply.
Waiting for a sample.
0 Kudos
RokuJoel
Binge Watcher

Re: roVideoScreen

Untested example (since I don't have a working stream to check against at the moment). I've commented out the section that tries to extract a specific set of keys from the metadata and post them to a server.

function testmetadata()
p = CreateObject("roMessagePort")
video = CreateObject("roVideoScreen")
video.setMessagePort(p)
videoclip = CreateObject("roAssociativeArray")
videoclip.StreamBitrates = [0]
di=createobject("roDeviceInfo")
if di.getDisplayType()="HDTV" then
videoclip.StreamQualities = ["HD"]
else
videoclip.StreamQualities = ["SD"]
end if
videoclip.StreamFormat = "hls"
video.SetTimedMetaDataForKeys( [ ] )
videoclip.StreamUrls = ["http://myvideo.com/video.m3u8"]
video.SetContent(videoclip)
video.Show()
while true
msg = wait(0, video.GetMessagePort())
if type(msg) = "roVideoScreenEvent"
if msg.isTimedMetaData() then
timedMetaData = msg.GetInfo()
?timedMetaData
'adID = timedMetaData[“adID”]
'if adID <> invalid then
' adUrl = timedMetaData[“adUrl”]
' adSupplier = timedMetaData[“adSupplier”]
' adPTS = msg.GetIndex()
' Print "AD ID: ";adID
' Print "AD URL: ";adURL
' Print "AD Supplier:";adSupplier
' Print "AD PTS: ";adPTS
' SendAdTrackingToServer(adID, adUrl, adSupplier, adPTS)
'end if
else if msg.isScreenClosed() then
print "Closing video screen"
return -1
else if msg.isRequestFailed()
print "play failed: "; msg.GetMessage()
return -2
else
print "Unknown event: "; msg.GetType(); " msg: "; msg.GetMessage()
end if
end if
end while
end sub
0 Kudos
gokool
Visitor

Re: roVideoScreen

"RokuJoel" wrote:
Untested example (since I don't have a working stream to check against at the moment). I've commented out the section that tries to extract a specific set of keys from the metadata and post them to a server.

function testmetadata()
p = CreateObject("roMessagePort")
video = CreateObject("roVideoScreen")
video.setMessagePort(p)
videoclip = CreateObject("roAssociativeArray")
videoclip.StreamBitrates = [0]
di=createobject("roDeviceInfo")
if di.getDisplayType()="HDTV" then
videoclip.StreamQualities = ["HD"]
else
videoclip.StreamQualities = ["SD"]
end if
videoclip.StreamFormat = "hls"
video.SetTimedMetaDataForKeys( [ ] )
videoclip.StreamUrls = ["http://myvideo.com/video.m3u8"]
video.SetContent(videoclip)
video.Show()
while true
msg = wait(0, video.GetMessagePort())
if type(msg) = "roVideoScreenEvent"
if msg.isTimedMetaData() then
timedMetaData = msg.GetInfo()
?timedMetaData
'adID = timedMetaData[“adID”]
'if adID <> invalid then
' adUrl = timedMetaData[“adUrl”]
' adSupplier = timedMetaData[“adSupplier”]
' adPTS = msg.GetIndex()
' Print "AD ID: ";adID
' Print "AD URL: ";adURL
' Print "AD Supplier:";adSupplier
' Print "AD PTS: ";adPTS
' SendAdTrackingToServer(adID, adUrl, adSupplier, adPTS)
'end if
else if msg.isScreenClosed() then
print "Closing video screen"
return -1
else if msg.isRequestFailed()
print "play failed: "; msg.GetMessage()
return -2
else
print "Unknown event: "; msg.GetType(); " msg: "; msg.GetMessage()
end if
end if
end while
end sub


Understood.
Thanks
0 Kudos