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

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()
Regards,
Patryk Rzucidlo (PTKDev)

Find me on social, forum and app with nickname "PTKDev".
Portfolio: http://www.ptkdev.it
Skype: ptkdev | Twitter: @ptkdev | LinkedIN: ptkdev | CurriculumVitae: http://cv.ptkdev.it
0 Kudos
7 REPLIES 7
sonnykr
Visitor

Re: roVideoPlayer with roScreen

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.
0 Kudos
RokuMarkn
Visitor

Re: roVideoPlayer with roScreen

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
0 Kudos
PTKDev
Visitor

Re: roVideoPlayer with roScreen

"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?
Regards,
Patryk Rzucidlo (PTKDev)

Find me on social, forum and app with nickname "PTKDev".
Portfolio: http://www.ptkdev.it
Skype: ptkdev | Twitter: @ptkdev | LinkedIN: ptkdev | CurriculumVitae: http://cv.ptkdev.it
0 Kudos
squirreltown
Roku Guru

Re: roVideoPlayer with roScreen

"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.
Kinetics Screensavers
0 Kudos
PTKDev
Visitor

Re: roVideoPlayer with roScreen

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
Regards,
Patryk Rzucidlo (PTKDev)

Find me on social, forum and app with nickname "PTKDev".
Portfolio: http://www.ptkdev.it
Skype: ptkdev | Twitter: @ptkdev | LinkedIN: ptkdev | CurriculumVitae: http://cv.ptkdev.it
0 Kudos
squirreltown
Roku Guru

Re: roVideoPlayer with roScreen

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.
Kinetics Screensavers
0 Kudos
PTKDev
Visitor

Re: roVideoPlayer with roScreen

"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!
Regards,
Patryk Rzucidlo (PTKDev)

Find me on social, forum and app with nickname "PTKDev".
Portfolio: http://www.ptkdev.it
Skype: ptkdev | Twitter: @ptkdev | LinkedIN: ptkdev | CurriculumVitae: http://cv.ptkdev.it
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.