SuperStrict
Import pantson.mpeg

Local m:Tmpeg
Local p:TPixmap

' load in movie
m = OpenMPEG("drwho.mpg")

' auto loop the movie (warning EOM never exists)
m.autoloop = True

' create graphics
Graphics 800,600,16

' create a pixmap fullscreen
p = CreatePixmap(MPEGwidth(m),MPEGheight(m),PF_STDFORMAT)

' start MPEG at start (0 seconds)
StartMPEG(m)

' repeat until end of movie or escape key pressed
While Not EOM(m) And Not KeyDown(key_escape)
	' check to see if frame has been drawn
	DrawText "Press [space] to pause",0,20
	DrawText "Press [q] to jump to random point",0,40

	If DrawMPEG(m,p) = True	
		' draw movie centered		
		DrawPixmap p,0,110
		
		' flip graphics
		Flip
	EndIf

	' random start between 0 and 25 seconds
	If KeyHit(key_q) Then StartMPEG(m,Rand(0,5))
	
	' pause movie if space pressed
	If KeyHit(key_space) Then PauseMPEG(m)
Wend

' end
CloseMPEG(m)

End
