roVideoScreen

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

thanks.

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

“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.

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

“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