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: 
newchannel
Roku Guru

How to get buffer bar to show up?..Please advise what to do.

I have a graphic that opens when channel is picked. Then it goes black and then the video begins playing.

How can I get a buffer to show the video is loading instead of the black screen before the video plays?

The videos are a list in the xml that play in order.

I posted another note in the forum about how to get the main graphic to stay on the screen while video loads but nothing in that code I posted is working. So I have it messed up most likely.

So if I can at least get a buffer bar to show then that should work so the viewer knows the channel is loading and I can get this channel approved this week.

Thank you if you can help at all.
http://www.victoryNOWfilmsandtv.com
0 Kudos
9 REPLIES 9
destruk
Binge Watcher

Re: How to get buffer bar to show up?..Please advise what to

If you're using roVideoScreen to play the video, the buffer bar is a built-in feature it does for you.
Otherwise you'd want to look at roCustomVideoPlayer from the SDK sample files - which overlays a text and percentage while the video buffers.
0 Kudos
newchannel
Roku Guru

Re: How to get buffer bar to show up?..Please advise what to

I have a list of videos in xml that play in order. When I submitted the channel I was told that after the splash screen it goes to black before the list of videos play. I am suppose to show the viewer that the channel is loading instead of the black screen. I have been attempting to have an image stay on the screen because for now it shows like this when click channel: splash, then black screen then video plays.

I tried some code to keep an image on the screen but the image just flickered off and on constantly even while the video is playing. So I then decided to see if I should just make it work with a buffer bar after the splash to tell viewer the channel is loading. Thought it might be a fix for it, wasn't sure.

When I tried to make the image stay on screen, this is what I did. Joel provided the following:

    bmp=createobject("roBitmap","pkg:/images/myimage.jpg")
bmp.setAlphaEnable(true)


screen.drawobject(x,y,bmp)



screen.setAlphaEnable(true)



Now what happens is I get splash, then an image that flickers, then video plays and image remains flickering even when the video plays. Thought I may have the code in the wrong area so I made many changes but still the image remained on screen flickering.

After many failed attempts, the thought of the buffer bar came to mind. If you have some input on how I can make the bitmap image not flicker, maybe I can get that corrected and then I wont need to do buffer bar and make a ton changes.

Thanks.
http://www.victoryNOWfilmsandtv.com
0 Kudos
destruk
Binge Watcher

Re: How to get buffer bar to show up?..Please advise what to

roScreen would be sharing video memory with everything else - try using roImageCanvas to create the splash screen, and then use roVideoScreen to play the videos. This will handle pause, the loading bars, etc etc for you.
0 Kudos
RokuJoel
Binge Watcher

Re: How to get buffer bar to show up?..Please advise what to

The image is flickering because you need to clear the back-buffer - so after your video starts playing you should use screen.clear(&h00000000)

...

else if msg.isStatusMessage()
if msg.getmessage()="start of play" then
screen.clear(&h00000000)
screen.swapbuffers()
screen.clear(&h00000000)
screen.swapbuffers()


Not the most elegant way to do it, but this should work.

- Joel
0 Kudos
RokuJoel
Binge Watcher

Re: How to get buffer bar to show up?..Please advise what to

As far as a buffer bar goes, there are a few ways to do it, the simplest would be to use screen.drawRect(x,y,buffered,30,RGBA_Color) for example where buffered is something like msg.getindex().toint() / 10 and rgba_color is a value like:

&h0000eb00

which should be an NTSC safe blue, for example.

else if msg.IsStatusMessage() 
if msg.getmessage()="start of play" then
screen.clear(&h00000000)
screen.swapbuffers()
screen.clear(&h00000000)
screen.swapbuffers()
end if
if msg.getindex() < 1000
screen.drawrect(x,y,msg.getindex().toint()/30,&h0000egb00)
end if


That would be a quick and trick to get some indication that buffering is taking place.

- Joel
0 Kudos
newchannel
Roku Guru

Re: How to get buffer bar to show up?..Please advise what to

One the one section where I made a change based on clearing the screen to make image stop flickering as you mentioned. This is where I added it:

Else If Type(msg)="roVideoPlayerEvent"
If msg.isStatusMessage()
If msg.GetMessage()="startup progress" then
screen.clear(&h00000000)
screen.swapbuffers()
screen.clear(&h00000000)
screen.swapbuffers()
'Print"buffering=";msg.GetIndex()/10
If msg.GetIndex()/10=100 Print "Playing Video #:";index
Else If msg.GetMessage()="end of stream"
Print"message is full result event - back to position 0"
If index<max
index=index+1
RegWrite("indexpos",index.ToStr(),"studioc")
Else
index=0
RegWrite("indexpos",index.ToStr(),"studioc")
End If
RegWrite("indextime","0","studioc")
End If
Else If msg.isPlaybackPosition()
indextime=msg.GetIndex()
RegWrite("indextime",msg.GetIndex().ToStr(),"studioc")
Else If msg.isStreamStarted()
Print"stream started event"
Else If msg.isFullResult()
Print"message is full result event"
Else If msg.isRequestFailed()
Print"Video #:";index;" ";msg.GetMessage()
End If
canvas.drawobject(0,0,bmp)
End If
canvas.SwapBuffers()
End While
End Sub


What it does now is splash, blank screen, can hear video but can not see it playing.

Also, the bitmap image that I need to have in the package, can it be the same channel logo or does it have to actually be an image with the words "your channel is loading" ?


Thank you!
http://www.victoryNOWfilmsandtv.com
0 Kudos
newchannel
Roku Guru

Re: How to get buffer bar to show up?..Please advise what to

debugger gives this:

'Dot' Operator attempted with invalid BrightScript Component or interface refere
nce. (runtime error &hec) in ...AADxT5rJ/pkg:/source/main.brs(129)
129: screen.clear(&h000000
00)
Backtrace:
Function runuserinterface() As Void
file/line: /tmp/plugin/CABAAADxT5rJ/pkg:/source/main.brs(129)
http://www.victoryNOWfilmsandtv.com
0 Kudos
TheEndless
Channel Surfer

Re: How to get buffer bar to show up?..Please advise what to

"newchannel" wrote:
debugger gives this:

'Dot' Operator attempted with invalid BrightScript Component or interface refere
nce. (runtime error &hec) in ...AADxT5rJ/pkg:/source/main.brs(129)
129: screen.clear(&h000000
00)
Backtrace:
Function runuserinterface() As Void
file/line: /tmp/plugin/CABAAADxT5rJ/pkg:/source/main.brs(129)

You named your roScreen variable "canvas" not "screen", so that line should be "canvas.clear(&H00000000)".
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
newchannel
Roku Guru

Re: How to get buffer bar to show up?..Please advise what to

Thank you TheEndless. I did not even catch that after making so many changes and attempts.

I now have the video playing again but the image is still flickering on and off while the video plays.

It is splash, then brief blank screen then image flickering, then video with image flickering over it.

The goal is to meet this requirement per roku:

Issues found:

1. No loading/retrieving icon while loading
http://www.victoryNOWfilmsandtv.com
0 Kudos