How To Play Sounds In iPhone ?

The iphone media player is very easy to use.

Step 1: First, create a view based iPhone application in xcode and add a button to your view that will play the sound.

Step 2: Drag in the Audio Toolbox framework into your frameworks group in XCode. Just Right click Frameworks from Groups&Files>add>existing framework>Framework>Audio ToolBox.framework>then add to project.

Step 3: Add  a short sound file to your project . Simple,just play the sound in an IBAction “playSound”.




Step 4: If you want to play  .mp3 sound to your application, you need to play the sound in an IBAction “playSong”.




You can downloaded SourceCode from here MusicPlayer

Leave a Comment: