Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Search instead for 
Did you mean: 
nithyaak
Level 7

roScreen and roVideoPlayer help

Hi,
I am trying to understanding how to get roScreen and rovideoPlayer work . I manage to get a video played however, its not displaying in the screen. i can hear the audio but not video. it appears its running on the background.

Could someone please help me how to get the video displayed! . Thanks a bunch.

I am calling this function from roSpringboardScreen screen when "play button is pressed"

Function screentest()

p = CreateObject("roMessagePort")
screen=createobject("roscreen",true,1280, 720)

obj1={posx:0,posy:0}

screen.setalphaenable(false)
screen.SetMessagePort(p)

screen.clear(&h000000FF) 'clear screen to black
'screen.
targetrect = { x: 300, y: 300, w: 320, h: 180 }

player= CreateObject("roVideoPlayer")
player.SetMessagePort(p)
player.SetPositionNotificationPeriod(1)
player.SetDestinationRect(targetrect)
'player.SetDestinationRect({x:0, y:0, w:0, h:0})
player.SetContentList([{
Stream: { url: "http://video.ted.com/talks/podcast/CraigVenter_2008_480.mp4" }
StreamFormat: "mp4"
SwitchingStrategy: "full-adaptation"
}])


player.Play()

'screen.drawobject(obj1.posx,obj1.posy,player)
screen.SwapBuffers()
' fontReg = CreateObject("roFontRegistry")
' font = fontReg.GetDefaultFont()
' screen.DrawText("Hello world....", 100, 100, &hFF00FF00, font)
'screen.SwapBuffers()
' screen.Finish()
while true
'msg = wait(0, canvas.GetMessagePort())
msg=player.GetMessagePort().getmessage()
'print "msg.....";msg
if type(msg) = "roVideoPlayerEvent"
if msg.isFullResult()
exit while
else if msg.isPartialResult()
exit while
else if msg.isRequestFailed()
print "isRequestFailed"
exit while
else if msg.isStatusMessage()
if msg.GetMessage() = "start of play"
print ""start of play""


end if
else if msg.isPlaybackPosition()
print "isPlaybackPosition: " + msg.GetIndex().ToStr()

end if

end if
end while

End Function
0 Kudos
2 Replies
NewManLiving
Level 7

Re: roScreen and roVideoPlayer help

Not well documented but you need to draw a transparent
Rectangle around the dimensions of your
Videoplayer. Called punching a hole or a portal
Yeah I know it know it sounds absurd
My Channels: 2D API Framework Presentation: https://owner.roku.com/add/2M9LCVC
Updated: 11-11-2015 - Completed Keyboard interface
The Joel Channel ( Final Beta )
0 Kudos
EnTerr
Level 8

Re: roScreen and roVideoPlayer help

"NewManLiving" wrote:
Not well documented but you need to draw a transparent Rectangle around the dimensions of your Videoplayer. Called punching a hole or a portal


Hm, yeah. I remember reading somewhere about the video and graphics planes - but alas i cannot find it in the RTFM. I find this in an earlier thread and seems to me so insightful, i'll quote it here for posterity:
"RokuMarkn" wrote:
The video plane is "below" (lower z-order) than the graphics plane. This is a feature of the hardware in all products. [...] The only reason it looks like it's in front of graphics is because it's showing through the transparent hole you've punched in the graphics plane.

An roScreen and everything that's drawn to it, either directly or via roCompositor, is drawn on the graphics plane. [...] In fact all screen types except the video player (with the complicated exception of roGridScreen) are drawn to the graphics plane. The only reason video is ever visible is when there is transparency in the graphics plane to reveal part or all of the video plane. This is why video display works the way it does.
RokuCo - include this in documentation?
0 Kudos