Maybe rename the Movie commands?

Everything else that doesn't fall into one of the other PB categories.
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Maybe rename the Movie commands?

Post by PB »

I was just looking at the "Movie" sections of the docs where it says...

any kind of media can be played with this library: AVI, MPG, DivX, Mp3 etc

...and it got me thinking -- I've seen sources with blocks like this:

Code: Select all

LoadMovie(1, "Video.mpg")
LoadMovie(2, "Track.mp3")
LoadMovie(3, "Sound.wav")
Looks a bit silly? So, maybe "LoadMedia" would be a better command, and
in fact rename all the "Movie" commands to "Media" instead? Take a look:

Code: Select all

LoadMedia(1, "Video.mpg")
LoadMedia(2, "Track.mp3")
LoadMedia(3, "Sound.wav")
What do you think?
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
Baldrick
Addict
Addict
Posts: 860
Joined: Fri Jul 02, 2004 6:49 pm
Location: Australia

Post by Baldrick »

LoadMedia(1, "Video.mpg"), etc sounds very logical and quite a good idea to me PB.

Looking at this post got me to wondering if my recent unneeded reformat may have fixed up the little bug I had with the movie commands & playing music, so I gave it a quick try but alas, nope, moviestatus() still refuses to return 0 for me when a song finishes playing.
Try this bit of code for me & see if it runs properly for you.

Code: Select all


If OpenWindow(0,50,50,200,200,#PB_Window_SystemMenu|#PB_Window_TitleBar,"Test")
init=InitMovie()
If init
load=LoadMovie(0,"C:\Windows\Media\Windows XP Startup.wav")
;load=LoadMovie(0,"C:\Program Files\PureBasic\My Projects\GraphicsStuff\Media\V822.mp3")
If load
play=PlayMovie(0,WindowID())
Delay(100) ; give song a chance to start playing
EndIf
EndIf
Else
End
EndIf
Repeat
EventID=WindowEvent()
If EventID=0:Delay(1):Else:Delay(0):EndIf
status=MovieStatus() ; should return 0 when music stops, but not on my computer ?? (PB3.94 only )
Debug status        ; used to work fine on PB3.93
If status=0
If play
stop=StopMovie()
EndIf
Debug "song has finished playing"
Quit=1
EndIf
If EventID=#PB_Event_CloseWindow
Quit=1
EndIf
Until Quit=1 
FreeMovie(0)
End
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

> moviestatus() still refuses to return 0 for me when a song finishes playing

It may be related to the actual media being played. For example, I've got
some music videos and three of them will NEVER return 0 for MovieStatus()
when they finish, but all other videos do. So, I don't know what's going on,
but I think it's due to corrupted and/or incorrectly-encoded media.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
urland
User
User
Posts: 13
Joined: Tue May 13, 2003 6:53 pm

Post by urland »

I put together a media player a couple of years ago and this week I decided to work on it a bit more. All playlists of mp3 files always worked before this with MovieStatus() returning 0 when they finished. After compiling with 3.94 MovieStatus() definately appears to be broken. It no longer returns 0 when an mp3 is finished playing and this is with the same mp3's that successfully worked with earlier versions of the compiler. Hope we get a fix soon. :)

P.S. LoadMedia(), etc. sounds like a great idea. It does encompass the definition of what the library does in a better way.
Post Reply