pausing a movie

BlitzPlus Forums/BlitzPlus Programming/pausing a movie

elias_t(Posted 2004) [#1]
Is there anyway to pause the movie in b+ or am I missing something?

Right now just halting the loop doesn't seem to pause the started movie....


Beaker(Posted 2004) [#2]
I think there is much more we could have with movies: pause, frameseek etc.


Hansie(Posted 2004) [#3]
BlitzMax will probably deliver it all ...


Yan(Posted 2004) [#4]
Came across this on me HD today.

Not really sure how useful it is or even if it works properly...:o/

Still, something to play with :o)

;--------------------------------------------------------------------------------------
;winmm.decls
;--------------------------------------------------------------------------------------
;.lib "winmm.dll" 
;
;winmm_mciSendString%(Command$,ReturnString*,ReturnLength%,Callback%):"mciSendStringA" 
;winmm_mciExecute%(Text$):"mciExecute" 
;winmm_mciGetErrorString%(Error%, Buffer*, Length%):"mciGetErrorStringA"
;--------------------------------------------------------------------------------------


AppTitle "test"
 
Graphics3D 640,480, 0, 2

bbHwnd=FindWindow("Blitz Runtime Class","test")

movie = open_avi(bbHwnd, "C:\fraps\wg.avi", 0, 0, GraphicsWidth(), GraphicsHeight()) 

play_avi(movie)

WaitKey()

close_avi(movie)

WaitMouse()

End 

Function open_avi(hwnd, video$, x=0, y=0, w=0, h=0, hidden=1)
	Local alias = MilliSecs(), ret
	 
	ret = winmm_mciExecute("open " + video$ + " type AVIVideo alias " + alias + " parent " + hwnd + " Style child")			
	If ret = False
		close_avi(alias)
		Return 0
	EndIf
	
	winmm_mciExecute("put " + alias + " window at " + x + " " + y + " " + w + " " + h)
	
	If hidden Then winmm_mciExecute("window " + alias + " state hide") 
	
	Return alias 
End Function

Function length_avi(alias)
	Local result, t, c, out$
	
	result = CreateBank(12) 
	winmm_mciExecute("set " + alias + " time format frames") ; Should be the default. Just making sure.
	winmm_mciSendString("status " + alias + " length", result, 12, 0)
	
	For t=0 To 11
		c = PeekByte(result, t)
		If c = 0
			Exit
		Else
			out$ = out$ + Chr$(c)
		EndIf
	Next
	FreeBank result
	
	Return out$
End Function

Function close_avi(alias)
	winmm_mciExecute("close " + alias)
End Function

Function seek_avi(alias, pos)
	If pos > length_avi(alias) Then Return 1	
	winmm_mciExecute("seek " + alias + " to " + pos)
End Function

Function play_avi(alias)
	winmm_mciExecute("window " + alias + " state show")
	winmm_mciExecute("play " + alias)
End Function

Function stop_avi(alias)
	winmm_mciExecute("stop " + alias)
End Function

Function pause_avi(alias)
	winmm_mciExecute("pause " + alias)
End Function

[edit]Oops, slight tweakage. What was I on when I wrote this?[/edit]


YAN