roVideoScreen seems to freeze

I have an roVideoScreen that is loading and seems to hang when it waits on a new message. I have verified the URL going in is valid [using Print urls.GetEntry(0)] and in my code I get the “in while loop” in telnet but nothing past that. The TV shows “retrieving” and never shows any progress on the progress bar. The remote buttons also don’t seem to do anything and I have to hit the home button to exit all the way out as the back button doesn’t work.

I’m sure I’ve missed something simple, but I would appreciate some help.


Sub ShowVideoScreen(StartPosition As Integer)
	port = CreateObject("roMessagePort")
	screen = CreateObject("roVideoScreen")
	episode = CreateObject("roAssociativeArray")
	episode.HDBranded = false
	episode.IsHD = false
	urls = CreateObject("roArray", 0, True)
	urls.Push(m.CurrentVideo.URL)
	Print urls.GetEntry(0)
	episode.StreamUrls = urls
	episode.StreamFormat = "mp4"
	screen.SetContent(episode)
	screen.SetMessagePort(port)
	screen.Show()
	print "before the while loop"
	while true
		Print "in while loop"
		msg = wait(0, screen.GetMessagePort())
		print type(msg)
		if type(msg) = "roVideoScreenEvent" then
			print "showVideoScreen | msg = "; msg.GetMessage() " | index = "; msg.GetIndex()
			if msg.isScreenClosed()
				print "Screen closed"
				exit while
			else if msg.isStatusMessage()
				print "status message: "; msg.GetMessage()
			else if msg.isPlaybackPosition()
				print "playback position: "; msg.GetIndex()
			else if msg.isFullResult()
				print "playback completed"
				exit while
			else if msg.isPartialResult()
				print "playback interrupted"
				exit while
			else if msg.isRequestFailed()
				print "request failed – error: "; msg.GetIndex();" – "; msg.GetMessage()
				exit while
			end if
		end if
	end while
	print "after the while loop"
End Sub

You’re missing a streambitrate, and streamqualities (SD/HD)
It’s annoying that roku won’t provide an error message for required content metadata that is missing. It will just stupidly sit there like this if you’re missing something it needs to initiate playback.

Best practice is to use the newer stream attributes of the content-meta-data rather than the old parallel arrays.

http://sdkdocs.roku.com/display/sdkdoc/ … +Meta-Data

video = {
  streamFormat: "mp4"
  streams: [
    { url: "http://www.example.com/500.mp4", bitrate: 500, quality: false }
    { url: "http://www.example.com/1000.mp4", bitrate: 1000, quality: false }
    { url: "http://www.example.com/1500.mp4", bitrate: 1500, quality: true }
    ' etc
  ]
}

Well, that’s annoying and problematic. I don’t know what the bitrate is and there is only one stream. I’ll just set it to the max known bit rate regardless of what the actual bitrate will be and see if that works I guess.

It does seem to work even when the bitrate isn’t even close to the video’s bitrate.

I would think setting a zero bitrate would be better. If there is only one bitrate stream, then you can load it in Quicktime or in VLC and get the average bitrate there.

  • Joel

Right now there are over 3000 video files it may pull, with more being added frequently. Most of them will be about 2650, 3950, or 5200, but I think I saw one as low as 900. None of the videos are multi-streamed, so hopefully it just never becomes an issue.

Typically people will use various command line tools to build up some meta data about each video and store it in a file or in a database so that they can generate the proper metadata for each video in their library when it is needed. There are also probably some commercial tools that do this as well.

  • Joel