Code: Select all
Global MovieName$
Procedure Thread(Void)
If LoadMovie(0, MovieName$)
OpenWindow(0, 100, 150, MovieWidth(0), MovieHeight(0), "PureBasic - Movie") ; "Movie not initialized"... although loading doesn't fail
PlayMovie(0, WindowID(0))
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
Else
MessageRequester("Error", "Can't load the movie...", 0)
EndIf
EndProcedure
If InitMovie() = 0
MessageRequester("Error", "Can't initialize movie playback !", 0)
End
EndIf
MovieName$ = OpenFileRequester("Choose the movie to play", "", "Movie/Audio files|*.avi;*.mpg;*.asf;*.mp3;*.wav|All Files|*.*", 0)
If MovieName$
;- Works:
; If LoadMovie(0, MovieName$)
;
; OpenWindow(0, 100, 150, MovieWidth(0), MovieHeight(0), "PureBasic - Movie")
; PlayMovie(0, WindowID(0))
;
; Repeat
; Until WaitWindowEvent() = #PB_Event_CloseWindow
; Else
; MessageRequester("Error", "Can't load the movie...", 0)
; EndIf
;- Doesn't work:
Thread = CreateThread(@Thread(), 0)
WaitThread(Thread)
EndIf
...so I don't see where the problem is.Help: LoadMovie() wrote:If the Result is 0, the movie can't be opened (format not supported or file not found), otherwise its ok. PlayMovie() can be used to start playing it.