RenderHeads / UnityPlugin-AVProVideo

AVPro Video is a multi-platform Unity plugin for advanced video playback
https://www.renderheads.com/products/avpro-video/
226 stars 28 forks source link

Video playback overlap #524

Closed DanielTocik closed 3 years ago

DanielTocik commented 3 years ago

Hello there, RenderHeads.

I got a very simple setup where I have the playing video (loop enabled in AVPro settings) and a stop/disable button. When I hit this stop button I would NOT like to see my video come to halt and disappear immediately. Instead, there would be an ‘’playback overlap’’. So after a mentioned stop button has been pressed, video would still continue to its end and only then it would stop/got disabled.

Is such a C# script/function possible within your AVPro and how would it look like?

Many thanks Dan Tocik

Ste-RH commented 3 years ago

Yes, what you require can be achieved. Unfortunately though, we cannot provide examples for every use-case and we do not offer support for anything past bugs or questions beyond AVPro Video supported functionality. That said I will outline what I believe might be the steps you might take in this instance.

If I understand correctly this sort of flow might be what you are looking to do:

1) Play a video that will loop forever 2) Prepare another MediaPlayer object with the 'next' video 3) At some point the user signals to 'move to next video'. At this point you should disable looping of the playing video 4) Watch for the 'finished' event that AVPro Video fires. On this event, swap out to the 'next' video and call play on that

Something like that might get you on your way.

You might want to take a look at the PlaylistMediaPlayer component (and demo: 14_Demo_PlaylistTransitions) we include in the asset. It might give you a good starting point.