Using scripting to play a sequence of videos back to back
One of the advantages of scripting is that it allows us to easily work with multiple items through loops, arrays, and so on. In this recipe, we’ll work with an array of Video Clip
assets and use scripting to play them back to back (one starts as soon as the previous clip finishes), illustrating the use of the isPrepared
and loopPointReached
events to avoid complicated loops and coroutines.
Getting ready
If you need video files to follow this recipe, please use the 54321TestVideo.mov
file included in the 14_01
folder and the jellyfish.wmv
video clip in 14_04
.
The Standalone Installer website is a good online source of test videos: http://mirrors.standaloneinstaller.com/video-sample/
How to do it...
To play a sequence of videos using scripting, follow these steps:
- Create a new Unity 3D project.
- Import the provided
54321TestVideo.mov
file, and perhaps a second video clip...