重复自动播放 [英] repeat playing automatically
本文介绍了重复自动播放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用下面的代码播放声音
I use below code for play sound
NSURL* musicFile = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"01" ofType:@"mp3"]];
AVAudioPlayer *audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:musicFile error:nil];
[audioPlayer play];
我想在完成后自动重复这个声音文件怎么样?
I want to repeat this sound file automatically when it's finish How ?
推荐答案
audioPlayer.numberOfLoops = someNumber;
或无限循环次数:
audioPlayer.numberOfLoops = -1;
这篇关于重复自动播放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文