Restored from previous forum. Originally posted by Tron.
Hey Everyone,
Does anyone know how to loop an MP3 with the PlayMovie(1, WindowID()) command?
I want to play an MP3 continuously, just like the PlaySound(1, 1) command allows you to loop a WAV file.
I tried using the MovieStatus() function, but it doesn't seem to respond the way I thought it would.
Does anyone have a good example for this?
Thanks,
Tron
"Honesty is the best policy, but insanity is a much better defense."
Music Looping
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Tron.
Thanks for the input!
Can you try my code and see if you can get the MovieStatus()=0 function to work in a loop with ScreenID() ? I think I am doing something wrong, or does this code work on your PC?
My code snippet:
;-----------------------------------------------------------------
If InitMovie() = 0
MessageRequester("Error", "Can't initialize Music playback.", 0)
End
EndIf
If InitSprite() = 0 Or InitKeyboard() = 0 Or InitMouse() = 0
MessageRequester("Error", "Can't open DirectX 7 or later.", 0)
End
EndIf
If OpenScreen(640, 480, 32, "Test")
LoadMovie(1, "test1.mp3")
Repeat
FlipBuffers()
ClearScreen(0,0,0)
If MovieStatus() = 0
PlayMovie(1, ScreenID())
EndIf
ExamineKeyboard()
Until KeyboardPushed(#PB_Key_Escape)
Else
MessageRequester("Error", "Can't open a 640*480 - 32 bit screen !", 0)
EndIf
End
"Honesty is the best policy, but insanity is a much better defense."
Hi Paul,If MovieStatus()=0
PlayMovie(1,WindowID())
EndIf
Thanks for the input!
Can you try my code and see if you can get the MovieStatus()=0 function to work in a loop with ScreenID() ? I think I am doing something wrong, or does this code work on your PC?
My code snippet:
;-----------------------------------------------------------------
If InitMovie() = 0
MessageRequester("Error", "Can't initialize Music playback.", 0)
End
EndIf
If InitSprite() = 0 Or InitKeyboard() = 0 Or InitMouse() = 0
MessageRequester("Error", "Can't open DirectX 7 or later.", 0)
End
EndIf
If OpenScreen(640, 480, 32, "Test")
LoadMovie(1, "test1.mp3")
Repeat
FlipBuffers()
ClearScreen(0,0,0)
If MovieStatus() = 0
PlayMovie(1, ScreenID())
EndIf
ExamineKeyboard()
Until KeyboardPushed(#PB_Key_Escape)
Else
MessageRequester("Error", "Can't open a 640*480 - 32 bit screen !", 0)
EndIf
End
"Honesty is the best policy, but insanity is a much better defense."
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Tron.
"Honesty is the best policy, but insanity is a much better defense."
I am using Windows ME, and this same exact code will not not start playing on my machine. I even tried several different MP3's from different sources. I can only get it to play if I move the MovieStatus()=0... code outside of my repeat loop. This is very strange. I will try to test on my work machine which is W2K, and see if it works like your machine does. This is very strange.I cut and pasted your code exact and it works fine with the MP3's that I have. As soon as they finish they start again. (I'm using Win2K)
"Honesty is the best policy, but insanity is a much better defense."