BR560
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2015
09:30 AM
RoUrlEvent not retrieving videos from server?
Hello! I am trying to retrieve videos from a server to play on my Roku channel. I've called every function on the urlEvent to see what the issue is. I'm not getting any errors on the telnet, so I'm not sure why the videos aren't coming through. There are other files I have that connect to the server, but this is the main one that should be getting the videos. Here is the snippet of code:
Everything is sent to the proper URL, and the telnet notifies me that a resource has been returned. Here is what I get:
function queryVideo( id, parameters = Invalid )
path = "/videos/" + id
path = path + "?" + uriEscape( "include[source]" ) + "=" + uriEscape( "true" )
request = createRequest( path )
if parameters <> Invalid
request = request.where( parameters )
end if
if request.query()
print "queryVideo: waiting for message"
while true
message = wait( 0, request.getMessagePort() )
if type( message ) = "roUrlEvent" then
event = message.getInt()
print "Event message: "; event
videoContent = message.getString()
failure = message.getFailureReason()
if videoContent = "" then
print "Failure reason: "; failure
else
print "Video content not empty"
end if
print "Failure reason: "; failure
print "Video content: "; videoContent
responseCode = message.getResponseCode()
print "Get response code: "; responseCode
' stop
response = createResponse( message )
if response.isSuccess() then
print "Response is successful"
resource = response.getResources()[0]
if resource <> Invalid then
resource[ "sources" ] = response.getResourcesByName( "video_sources" )
return resource
else
return Invalid
print "Invalid"
end if
else
print "queryVideo failed"
return Invalid
end if
end if
end while
end if
return Invalid
end function
Everything is sent to the proper URL, and the telnet notifies me that a resource has been returned. Here is what I get:
queryArtifactArtifacts: waiting for message
queryArtifactArtifacts: returned 1 resources.
queryVideo: waiting for message
Event message: 1
Video content not empty
Failure reason: OK
Video content: {"$this":{"name":"videos","type_name":"video","ids":[124189]},"videos":[{"type_name":"video","id":124189,"created_at":"2015-06-04T19:39:02.929295Z","updated_at":"2015-06-09T00:36:45.615637Z","content_type":"video/mp4","filename":"NA_MTO_DGR_206-BXX.mp4","size":null,"storage_key":"cnU1ZinATsG6zWFx4HcS_NA_MTO_DGR_206-BXX.mp4","height":null,"width":null,"duration":"580","picture_id":"125465","codec":null,"codec_long":null,"color_and_chroma":null,"profile":null,"level":null,"bit_rate":null,"frame_rate":null,"display_aspect_ratio":null,"sample_aspect_ratio":null,"audio_codec":null,"audio_codec_long":null,"audio_channels":null,"audio_bit_rate":null,"audio_sample_rate":null,"audio_channel_layout":null}]}
Get response code: 200
Response is successful
4 REPLIES 4

RokuMarkn
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2015
10:10 AM
Re: RoUrlEvent not retrieving videos from server?
Sorry, I don't understand what the problem is. You are making a request for a URL and correctly retrieving it. All the code you've posted seems to be working fine. But what does "videos aren't coming through" mean? Do you have a VideoPlayer somewhere else in your code that's not working?
--Mark
--Mark
BR560
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2015
10:19 AM
Re: RoUrlEvent not retrieving videos from server?
"RokuMarkn" wrote:
Sorry, I don't understand what the problem is. You are making a request for a URL and correctly retrieving it. All the code you've posted seems to be working fine. But what does "videos aren't coming through" mean? Do you have a VideoPlayer somewhere else in your code that's not working?
--Mark
I meant that the videos from the server do not play when I click them. The screen just says "Retrieving" and never ends up playing the video chosen. My videoScreen file seems to be working perfectly fine as well since it does not give back any error messages in telnet. Everything seems to be connected from what I can see.

RokuMarkn
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2015
11:01 AM
Re: RoUrlEvent not retrieving videos from server?
Ok, but you didn't post any code or messages from your VideoScreen, you posted a function that downloads a text file and the messages that result from a successful download. This has nothing to do with playing video.
Do you see any messages on the debug console when you click a video?
--Mark
Do you see any messages on the debug console when you click a video?
--Mark
BR560
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2015
11:13 AM
Re: RoUrlEvent not retrieving videos from server?
"RokuMarkn" wrote:
Ok, but you didn't post any code or messages from your VideoScreen, you posted a function that downloads a text file and the messages that result from a successful download. This has nothing to do with playing video.
Do you see any messages on the debug console when you click a video?
--Mark
Whoops, I just assumed the issue was with the code I posted, since, no, I do not get any error messages on the videoScreen when I click a video. Here is the videoScreen code:
function createArtifactVideo( artifact, relatedArtifacts )
ArtifactVideo = {
initialize: initializeArtifactVideo
populate: populateArtifactVideo
show: showArtifactVideo
screen: Invalid
port: Invalid
artifact: Invalid
relatedArtifacts: Invalid
artifactVideo: Invalid
index: Invalid
lastIndex: Invalid
}
ArtifactVideo.initialize( artifact, relatedArtifacts )
return ArtifactVideo
end function
function initializeArtifactVideo( artifact, relatedArtifacts )
m.screen = createObject( "roVideoScreen" )
m.port = createObject( "roMessagePort" )
m.screen.setMessagePort( m.port )
m.relatedArtifacts = relatedArtifacts
m.populate( artifact )
end function
function showArtifactVideo()
m.screen.show()
while true
message = wait( 0, m.port )
if type( message ) = "roVideoScreenEvent" then
print "Video Screen message: "; message.getMessage() " and Index: "; message.GetIndex()
if message.isScreenClosed()
print "Screen closed"
exit while
lastIndex = m.relatedArtifacts.count() - 1
for index = 0 to lastIndex
if m.relatedArtifacts[ index ].id = m.artifact.id then
exit for
end if
end for
if ( index + 1 <= lastIndex ) then
m.initialize( m.relatedArtifacts[ index + 1 ], m.relatedArtifacts )
m.show()
end if
end if
end if
end while
end function
function populateArtifactVideo( artifact )
if artifact <> Invalid then
m.artifact = artifact
m.artifactVideo = queryVideo( artifact.provider_uid )
' stop
content = artifactToContent( artifact )
content[ "streamUrls" ] = ""
' content = {
' streamUrls: "http://videos.boxxspring.com/" + video_sources.storage_key
' streamBitrates: [ 0 ]
' streamQualities: [ "HD" ]
' streamFormat: "mp4"
' }
' if content.streamUrls <> invalid then
' print "video URL is valid"
' else
' print "video URL is INVALID"
' end if
m.screen.setContent( content )
end if
end function
The telnet shows ithe sending/retrieving of the URL -- nothing is broken. So confused! 😐
Thanks!