开发者

AVAudioPlayer freezes when play first song

开发者 https://www.devze.com 2023-04-08 08:50 出处:网络
I\'m using AVAudioPlayer class to play sound in my app. When i play sound first time, screen freezes for a 2-3 seconds, then it becomes active and without freezes and delays. Even when I change sound.

I'm using AVAudioPlayer class to play sound in my app. When i play sound first time, screen freezes for a 2-3 seconds, then it becomes active and without freezes and delays. Even when I change sound. Here is some code:

avPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:nil];
[avPlayer prepareToPlay];
[avPlayer play];

Sound f开发者_如何学Pythoniles are in Documents folder and file paths are correct; How to minimize delay or remove freezes?

0

精彩评论

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