; OpenMovie Example ; ----------------- Graphics 640,480,0,2 SetBuffer BackBuffer() ; Blitz3D+ ships no video, so this example plays one of yours: copy a ; video file called my_movie.avi next to this .bb file. Windows Media ; Foundation does the decoding, so anything your PC already plays works. movie_file$="my_movie.avi" found=0 If FileType(movie_file)=1 Then found=1 ; Show a frame before we block, so the window is never blank Cls Text 0,0,"OpenMovie loads a video file and hands back a movie handle." Text 0,40,"Looking for "+movie_file+" in this example's folder" If found Then Text 0,60,"Found it." Else Text 0,60,"Not there - copy a video file in under that name to see it play." End If Text 0,100,"Press and hold Y to open it, or any other key to skip" Flip WaitKey ; Only open a file we know is there. OpenMovie returns 0 when the file ; is missing or cannot be decoded, and every other movie command needs ; a real handle, so this is the moment to check. movie=0 If KeyDown(21) And found Then movie=OpenMovie(movie_file) spin#=0 While Not KeyDown(1) Cls If movie<>0 Then ; A real movie - draw it at its own size DrawMovie movie,20,80 Text 0,20,"OpenMovie gave a usable handle" Text 0,40,"The movie is "+MovieWidth(movie)+" x "+MovieHeight(movie) Else ; Nothing open - keep something moving so the window is alive spin=spin+3 Color 90,120,190 Oval 308+Cos(spin)*70,240+Sin(spin)*70,24,24,1 Color 255,255,255 Text 0,20,"No movie open - OpenMovie was skipped or returned 0" Text 0,40,"A 0 handle means the file was missing or could not be decoded." Text 0,60,"Never pass 0 on to DrawMovie or MovieWidth - test it first." End If Text 0,0,"Esc: exit" Flip Wend ; Hand the movie back when you are finished with it If movie<>0 Then CloseMovie movie End