It is currently Tue May 26, 2020 5:37 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: How to play mp3 file?
PostPosted: Fri Sep 08, 2017 5:07 pm 
Offline
Enthusiast
Enthusiast

Joined: Tue Jan 30, 2007 5:47 am
Posts: 335
Location: Hong Kong
Any library or example?


Top
 Profile  
Reply with quote  
 Post subject: Re: How to play mp3 file?
PostPosted: Fri Sep 08, 2017 5:16 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Oct 09, 2010 3:47 am
Posts: 1617
Hi SkyManager,

A simple solution (depending on your requirements) is using the WebGadget: HTML Audio
- see the following for similar working examples
-- MP4 Player
-- YouTube Player

_________________

STATUS: Permanently Unavailable :: Downloads moved to My PureBasic Stuff
_________________


Top
 Profile  
Reply with quote  
 Post subject: Re: How to play mp3 file?
PostPosted: Fri Sep 08, 2017 6:27 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Wed Sep 21, 2011 9:11 am
Posts: 608
Location: France
Another solution : FModex (Unicode) PB 5.60 (x86 & x64)
:arrow: https://github.com/pbcodex/FMODEX-MIN-UNICODE

Try Fmod Ex - Play Sound.pb

_________________

➽ Windows 10 - PB 5.62 & PB 5.70 LTS

Sorry for my bad english and the Dunning–Kruger effect.


Top
 Profile  
Reply with quote  
 Post subject: Re: How to play mp3 file?
PostPosted: Fri Sep 08, 2017 6:40 pm 
Offline
PureBasic Expert
PureBasic Expert

Joined: Sun Apr 12, 2009 6:27 am
Posts: 3599
Simple and straightforward
Code:
If InitMovie() = 0
  MessageRequester("Error", "Can't initialize movie playback !", 0)
  End
EndIf

MovieName$ = OpenFileRequester("Choose the movie to play", "", "All Files|*.*", 0)
If MovieName$
  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
EndIf

_________________
Egypt my love


Top
 Profile  
Reply with quote  
 Post subject: Re: How to play mp3 file?
PostPosted: Fri Sep 08, 2017 7:47 pm 
Offline
Enthusiast
Enthusiast

Joined: Wed Nov 09, 2011 8:58 am
Posts: 586
Tiny solution (on Windows):

Code:

sfile.s = "C:\song.mp3"
mciSendString_("open " + sFile + " alias 1", 0, 0, 0)
mciSendString_("play 1 wait", 0, 0, 0);


_________________
My new project: A simple HTML/CSS UI engine for PB desktop apps
viewtopic.php?f=7&t=74582


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 13 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye