Movie problems

Just starting out? Need help? Post your questions and find answers here.
stan
User
User
Posts: 29
Joined: Tue Jun 10, 2003 2:46 pm

Movie problems

Post by stan »

Hi,

I have tried to make a small movie player, which doesn't work Reliably (sometimes it's OK, sometimes it stop playing ...), here is the code :

Code: Select all

InitMovie()
LoadMovie( 1, "output.avi")
UseMovie( 1 )

resize = 0

Width = MovieWidth()

If Width > 800
  Width = 800
  resize = 1
EndIf

Height = MovieHeight()

If Height > 600
  Height = 600
  resize = 1
EndIf

If resize = 1
  ResizeMovie(0, 0, Width, Height)
EndIf

WindowID = OpenWindow(10, 10, 10, Width, Height, #PB_Window_ScreenCentered|#PB_Window_BorderLess, "" )

If WindowID
  PlayMovie(1, WindowID)
  While MovieStatus( ) < 1 : Delay( 2 ) : Wend
  While MovieStatus() <> 0 : Delay( 1 ) : Wend
  CloseWindow(10)
  FreeMovie(1) 
EndIf

End
Could someone tell me where is my mistake ? (I've already try different delay values, with no success ...)

TIA.

Bests.

Stan.
GPI
PureBasic Expert
PureBasic Expert
Posts: 1394
Joined: Fri Apr 25, 2003 6:41 pm

Post by GPI »

maybe you should add a main-loop (windowevent())
stan
User
User
Posts: 29
Joined: Tue Jun 10, 2003 2:46 pm

Post by stan »

maybe you should add a main-loop (windowevent())
Thanks, but :

I also tried that (in the second loop) :

While MovieStatus() <> 0 : Delay( 1 ) : While WindowEvent() : Wend: Wend

Nothing works then ...

Do you mean adding it elsewhere ?

TIA.

Bests.

Stan.
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: Movie problems

Post by PB »

Your code works fine for me with MPG movies. When you say that it stops
playing, how far into the movie does this occur? Have you tried other AVIs?
stan
User
User
Posts: 29
Joined: Tue Jun 10, 2003 2:46 pm

Post by stan »

Hi,
Your code works fine for me with MPG movies. When you say that it stops
playing, how far into the movie does this occur? Have you tried other AVIs?
It stops randomly : using the very same AVI, it sometime works perfect twice in a row, then stop the next time anywhere, then works again fine the next time, which is puzzling (I always thought that a progarm either works or don't ...).

I've tried different AVIs (the output.avi is the default name for the program I use to make AVIs : SSMM 5.3.3) using different output Codecs,
all these AVIs run smoothly using Winamp3 or Zplayer.

Right now I solved the problem using Zplayer, but I would like to have my own player rather than Zplayer and understand why my program doesn't work ...

I am running it under Win98SE, with a Radeon 7500 (with the last available drivers), but the program I am trying to make should work under any Win version as it is intended to help my English teaching girlfriend to play a movie on any computer in her school ...

Maybe I should report it as a bug ? Unless someone sees something I missed ...

TIA.

Bests.

Stan.
Post Reply