I'm trying to play multiple sounds at the same time.
The approach initially I've taken was to create several players , but it seems wrong one.
What's the best way to play several audio files at the same time.
Is it through making them AVAssets, but in this case how would I stop and play them whenever I want.
Really appreciate your help.
The reason I need AVPlayer is to fetch sounds from the iPod Library.
I finally got an answer from TechSupport of Apple Dev Team and it seems I'm on the right track when I decided to use several AVPlayer.
Experience the exhilaration of watching and controlling up to 16 Awesome Videos all at the same time on one screen! Go ahead, we know you’ll love it, especially with that exciting AV collection. ; ) Why Use AVPlayer Instead of Other Media Players? Because watching AV one at a time is just so boring!
Then, declare the following state linking to AVAudioPlayer before the body variable and after the struct: As you can see, we have set up a text with 2 buttons below, one for playing the audio, the other one for pausing it. the syntax is pretty simple: audioPlayer.pause () and audioPlayer.play ().
The AVAudioPlayer class has other properties to control playback (such as the number of times to loop) as well as properties that give you information about the sound file (such as the duration). Check out the Apple class reference document for more information! Have you teamed up with a partner to develop an app?
Moreover, you can save your favorite videos in playlists for immediate reloading any time you want. And finally, AVPlayer is optimized to prioritize hardware decoding using the graphics card to be as efficiently as possible playing video files, while taking advantage of software codecs for maximum compatibility using the CPU whenever necessary.
For every sound you want to make make a new AVPlayer.
NSURL *url = [NSURL URLWithString:pathToYourFile];
AVPlayer *audioPlayer = [[AVPlayer alloc] initWithURL:url];
[audioPlayer play];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With