Page 1 of 1

Movie Commands fail in Threads

Posted: Mon Sep 29, 2008 1:51 am
by Paul
PlayMovie works fine normally but fails if you try to use in a Thread...

Working...

Code: Select all

InitMovie()  

Procedure Thread(flag.l)
  If OpenWindow(1,0,0,640,480,"")             
    LoadMovie(1,"AnimBar.mpg")
    PlayMovie(1,WindowID(1))

    quitThread=0
    Repeat
      If WindowEvent()=#PB_Event_CloseWindow
        quitThread=1
      EndIf

      Delay(1)
    Until quitThread
  EndIf
EndProcedure  
 
 
 
If OpenWindow(0,0,0,200,100,"Test",#PB_Window_ScreenCentered|#PB_Window_SystemMenu)
  Thread(0)
  
  Repeat    
  Until WaitWindowEvent()=#PB_Event_CloseWindow 
EndIf

Non working in Thread...

Code: Select all

InitMovie()  

Procedure Thread(flag.l)
  If OpenWindow(1,0,0,640,480,"")             
    LoadMovie(1,"AnimBar.mpg")
    PlayMovie(1,WindowID(1))   ;<<---- ERRORS ON THIS LINE

    quitThread=0
    Repeat
      If WindowEvent()=#PB_Event_CloseWindow
        quitThread=1
      EndIf

      Delay(1)
    Until quitThread
  EndIf
EndProcedure  
 
 
 
If OpenWindow(0,0,0,200,100,"Test",#PB_Window_ScreenCentered|#PB_Window_SystemMenu)
  CreateThread(@Thread(),0)

  Repeat    
  Until WaitWindowEvent()=#PB_Event_CloseWindow 
EndIf

Posted: Mon Sep 29, 2008 8:57 pm
by freak
Well, the commands are DirectX based, and DirectX has problems with threads. There is not much way around that.

Posted: Mon Sep 29, 2008 9:00 pm
by Paul
:cry: