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:
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