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: 

Play Videos Straight to roVideoPlayer

Hi Everyone,

I need to create a channel without any screens. Parsing the JSON, the video need to start to play in roVideoPlayer.

This is my requirement. And this is my sample code.

Function Main() as void

videoPlayer = CreateObject("roVideoPlayer")
port = CreateObject("roMessagePort")
videoPlayer.SetMessagePort(port)
LoadJSONFile(videoPlayer)

End Function

Function LoadJSONFile(videoPlayer as object) as void
jsonAsString = ReadAsciiFile("pkg:/json/sample1.json")
m.json = ParseJSON(jsonAsString)
LoadUrl(m.json.Videos,videoPlayer)
End Function

Function LoadUrl(feedData as object,videoPlayer as object) as Dynamic

contentList = []
for each video in feedData
contentList.Push({
Stream: { url: video.Url }
StreamFormat: "mp4"
})
end for

PlayVideo(contentList,videoPlayer)

End Function

Function PlayVideo(contentList as object,videoPlayer as object) as integer

videoPlayer.SetPositionNotificationPeriod(10)
videoPlayer.SetContentList(contentList)
videoPlayer.Play()

while true
msg = wait(0, videoPlayer.GetMessagePort())
if type(msg) = "roVideoPlayerEvent"
print msg.GetMessage()
end if
end while
End Function


When I tried to run the channel, It was showing only Loading screen. But in debugger, it is showing "startup progress" and "start of play" events.

So, What I need to do the display of video without any pre-screens.

Please anyone help on this.

Thank you,
P.Dineshkumar
I am using Roku 4 - 4400X Model.
0 Kudos
1 REPLY 1
belltown
Roku Guru

Re: Play Videos Straight to roVideoPlayer

You need roVideoScreen instead of roVideoPlayer.
0 Kudos