roVideoPlayer with roScreen

Hi!
Im here, again. I try set roVideoPlayer on roScreen but not work, my player is invisibile (or i nothing draw).
Who have solution for this issue?

NOTE: code fix 17:25 04/05/2015


    screen = CreateObject("roScreen")
    screen.SetMessagePort(port)
    screen.screen.SetAlphaEnable(true)
    screen.SwapBuffers()
    bitmap=CreateObject("roBitmap", "pkg:/images/background.png")
    screen.DrawObject(0,0, bitmap)
    player = CreateObject("roVideoPlayer")
    player.SetMessagePort(port)
    player.SetDestinationRect({x:200, y:200, w:200, h:200}) 
    player.SetContentList([{
      streamFormat:   "mp4"
      stream: { url: "http://www.test.com/test.mp4" }
    }])
    player.Play()
    screen.DrawObject(0, 0, player) ' not draw nothing
    screen.SwapBuffers()
    screen.finish()

How big is your bitmap? roVideoPlayer by default sits in the lowest z-index, and anything you draw with roScreen will be on a higher index.

Well, I see a few problems right off the bat. In line 6 you are using this.screen, but you never set that to anything (in the quoted code anyway). In the last line, you are attempting to draw an roVideoPlayer object to the screen, which doesn’t make any sense. And even if you were drawing something sensible, there’s no Finish or SwapBuffers call after that to finalize the drawing.

–Mark

“RokuMarkn” wrote:
Well, I see a few problems right off the bat. In line 6 you are using this.screen, but you never set that to anything (in the quoted code anyway). In the last line, you are attempting to draw an roVideoPlayer object to the screen, which doesn’t make any sense. And even if you were drawing something sensible, there’s no Finish or SwapBuffers call after that to finalize the drawing.

–Mark

Sorry for this.screen, is an error from copy/paste.
draw roVideoPlayer is no sense? How i draw roVideoPlayer over roScreen if this code is bad?

“PTKDev” wrote:
How i draw roVideoPlayer over roScreen if this code is bad?

videoplayer.Play()
Important to note you are drawing the videoplayer under the roScreen. If you don’t have a hole/transparency in the roScreen , you won’t see the video.

Solved.

But:

  • roUniversalControlEvent not work, i work for fix this
  • If i use DrawObject for draw roBitmap, work for show 3 image but n°4 image is hidden. Uhm
    
    white=&hFFFFFFFF 
    font_registry = CreateObject("roFontRegistry")
    font = font_registry.GetDefaultFont(10, false, false)
    font16px = font_registry.GetDefaultFont(16, true, false)
    player = CreateObject("roVideoPlayer")
    player.SetMessagePort(port)
    player.SetDestinationRect({x:54, y:128, w:450, h:350})
    player.SetContentList([{
      streamFormat:   "mp4"
      stream: { url: "http://techslides.com/demos/sample-videos/small.mp4" }
    }])
    player.Play()

    'this have rect trasparent for show player
    bitmap=CreateObject("roBitmap", "pkg:/images/test/bg_player.png") 
    screen.DrawObject(0, 124, bitmap)

    bitmap=CreateObject("roBitmap", "pkg:/images/header.png")
    screen.DrawObject(0,0, bitmap)

    while true
        if type(msg) = "roUniversalControlEvent" then
            code = msg.GetInt()
            
            if (code = 0) 'back
                return -1
            else if (code = 2) 'up
                return -1
            end if
            
        end if
    end while
while true
        if type(msg) = "roUniversalControlEvent" then
            code = msg.GetInt()
          

should be

while true
        msg = port.getmessage()
        if type(msg) = "roUniversalControlEvent" then
            code = msg.GetInt()
          

assuming you create a messageport somewhere called “port”, it’s not part of your snippet. You are drawing to screen and this.screen, maybe thats an issue.

“squirreltown” wrote:

while true
        if type(msg) = "roUniversalControlEvent" then
            code = msg.GetInt()
          

should be

while true
        msg = port.getmessage()
        if type(msg) = "roUniversalControlEvent" then
            code = msg.GetInt()
          

assuming you create a messageport somewhere called “port”, it’s not part of your snippet. You are drawing to screen and this.screen, maybe thats an issue.
That oversight! hehehe. Thanks!