Audio and video are quite common in the latest devices. An instance of the AVAudioPlayer class, called an audio player, provides playback of audio data from a file or memory. It is supported in iOS with the help of AV FOUNDATION.FRAMEWORK and Media Player. framework respectively.
Interested in taking up Online IOS Training? You are at the Right Place. Start Learning!
Add the AVFoundation Framework.
Framework Capture15 --> Add Capture15 --> Existing FrameWork Capture 15 --> AVFoundation Frame work.
How to get resources file path:
- Using an audio player you can:
- Play sounds of any duration
- Play sounds from files or memory buffers
- Loop sounds
- Play multiple sounds simultaneously, one sound per audio player, with precise synchronization
- Control relative playback level, stereo positioning, and playback rate for each sound you are playing
- Seek to a particular point in a sound file, which supports such application features as fast forward and rewind
- Obtain data you can use for playback-level metering
[ audioplayer set volume :1] // 0 to 1 (max value is 1)
[ audioplayer setNumberofLoops:2];
Subscribe to our youtube channel to get new updates..!
prepare to play:
[ audioplayer PrepareToplay];
[ audioplayer setDelegate: self]
[ audioplayer play];
[ audioplayer pause];