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

Fade in / Fade out between videos?

Hi folks,
just another question.

How doing simple transitions, ie fade, between videos?
I need build an application based upon XML playlist that look to an automate video mixer.

Any chance?
0 Kudos
12 REPLIES 12
jbrave
Channel Surfer

Re: Fade in / Fade out between videos?

havent tried it, but you should be able to fade an image canvas screen IN over the top of an rovideoscreen, or if you are using rovideo player, put the player on a lower layer of the screen. Getting fades to look right is kind of tricky, you have to play with the timing - the delay between updates to the screen and also the step for fading in - too big a step and it looks clunky, too fast an update and it doesn't work right.

To do a fade you will need to create a layer with #00000000 where the first 00 is the hex code for the transparancy and the rest of the 00's can be the hex code for the color.

Then using the bytearray ToHexString you can increment the value until the layer is faded in.

reverse the process to fade out. The only thing is will the video stay underneath the layer when the next video starts playing, or will it pop to the top? another thing to find out - probably if the new video isloaded and played within the same subroutine without exiting and creating a new player, this will work, alternatively, define the video player as a global m.videoplayer var (these can cause some big trouble, so be careful)
Screenshades: The first Screensaver for Roku2!
Musiclouds: The best free internet music, on your Roku!
Ouroborialis: Psychedelic Screensaver for Roku!
0 Kudos
TheEndless
Channel Surfer

Re: Fade in / Fade out between videos?

"jbrave" wrote:
havent tried it, but you should be able to fade an image canvas screen IN over the top of an rovideoscreen, or if you are using rovideo player, put the player on a lower layer of the screen.

I don't think you can draw a canvas on top of the roVideoScreen. I think you have to use the roVideoPlayer to do that.
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
jbrave
Channel Surfer

Re: Fade in / Fade out between videos?

I just tested it, you can indeed draw a canvas on top of a video screen, and fade IN. Fading out and getting rid of it once it is there is another story. closing the canvas if it is within the same sub will close the video. canvas.clear(layer) didn't seem to work either, although that seldom seems to work anyway...

- Joel
Screenshades: The first Screensaver for Roku2!
Musiclouds: The best free internet music, on your Roku!
Ouroborialis: Psychedelic Screensaver for Roku!
0 Kudos
dynamitemedia
Binge Watcher

Re: Fade in / Fade out between videos?

Joel what code did you do to add the canvas on top of the rovideoscreen?
Twitter: iptvmyway facebook: iptvmyay
Channels: Warriors of War, Go Fight Live, Heading Outdoorz, IPTVmyway
0 Kudos
destruk
Binge Watcher

Re: Fade in / Fade out between videos?

Couldn't you add the fade in/fade out to the beginning and end of the source video?
0 Kudos
dynamitemedia
Binge Watcher

Re: Fade in / Fade out between videos?

"jbrave" wrote:
I just tested it, you can indeed draw a canvas on top of a video screen, and fade IN. Fading out and getting rid of it once it is there is another story. closing the canvas if it is within the same sub will close the video. canvas.clear(layer) didn't seem to work either, although that seldom seems to work anyway...

- Joel



can you let us know how you did this so we can test it some more?
Twitter: iptvmyway facebook: iptvmyay
Channels: Warriors of War, Go Fight Live, Heading Outdoorz, IPTVmyway
0 Kudos
jbrave
Channel Surfer

Re: Fade in / Fade out between videos?

I don't like to give away all my secrets, but of course, I wouldn't be doing this Roku stuff if TheEndless hadn't shared with me, so:

Have a function called "loading"

function loading() as object
overlay=createobject("roimagecanvas")
return overlay
end function


Then in my Video screen, after

videoscreen.show()

I put

launch=loading()

Doing it like this seems to work. In my brief testing, I was unable to get this to work any other way.

launch.show()
art=getart() (returns a background image with no url so I can set the transparency

Now the next thing I did was to call a fade in routine which I pass my screen to:
fade(launch,art)

but since we don't really want to interfere with the iterations of the video player loop, you should really do all your fades in-line with the wait loop of the video, use msg=wait(50,port)

and run your fade routine in-line. Here is an in-line fade IN routine I created:

function inlinefade(screen as object,layer as integer,art as object, resets as boolean) as object        

st=5
if resets then
m.f=45
return screen
end if


ba=createobject("robytearray")
ba.push(int(m.f))
ba.push(255)
ba.push(255)
ba.push(255)
colorhex="#"+ba.tohexstring()
art.color=colorhex
screen.setlayer(layer,art)

m.f=m.f+st
art.color="#FFFFFFFF"
screen.setlayer(layer,art)
return screen
end function


where m.f is a global var to increment the transparency of the layer.

To set transparency back to zero, resets=true.

Hopefully this is helpful, and if you can make it work, please publish your resulting code, or at least a general outline of how it worked.

- Joel
Screenshades: The first Screensaver for Roku2!
Musiclouds: The best free internet music, on your Roku!
Ouroborialis: Psychedelic Screensaver for Roku!
0 Kudos
dynamitemedia
Binge Watcher

Re: Fade in / Fade out between videos?

next week when i get a better chance to fool with it i will, i had some cool things working in the roVideoPlayer.

Will post what i come up with, not 100% sure what your doing with some of your code so will need to study it some more.

Thanks maybe someone will beat me to it and get a cool example
Twitter: iptvmyway facebook: iptvmyay
Channels: Warriors of War, Go Fight Live, Heading Outdoorz, IPTVmyway
0 Kudos
jbrave
Channel Surfer

Re: Fade in / Fade out between videos?

The important thing *i think* is that function at the top of my post where I create the image canvas, because, as I said, when I create it in-line it wasn't working, I also tried just calling a sub that created the image canvas and then called a fade routine, and that didn't work either, of course I spent maybe 10 minutes on it.

- Joel
Screenshades: The first Screensaver for Roku2!
Musiclouds: The best free internet music, on your Roku!
Ouroborialis: Psychedelic Screensaver for Roku!
0 Kudos