开发者

How can I preload .mp3 in iOS while playing a song?

开发者 https://www.devze.com 2023-02-25 02:16 出处:网络
Is there any ability to preload a song (the next one in the game) while already playing the other one. I want the second song to start immediately after the first开发者_开发技巧 one. How can I achieve

Is there any ability to preload a song (the next one in the game) while already playing the other one. I want the second song to start immediately after the first开发者_开发技巧 one. How can I achieve this effect ?


Create a AVQueuePlayer, queue up all the tracks you want. Set the actionAtItemEnd = AVPlayerActionAtItemEndAdvance

This should then play them with no break. If you still get a break, try creating two separate AVPlayers, and then switch between them programmatically.


You can use schedular or timer-NSTimer method to play the song....


You can use SoundMaster engine. It's very easy to use, just uses AVAudioPlayer intelligently. It has handy completion block and music preload ability. It can preload multiple files.

0

精彩评论

暂无评论...
验证码 换一张
取 消