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

You need roVideoScreen instead of roVideoPlayer.