gpt4 book ai didi

ios - 自动重复播放

转载 作者:可可西里 更新时间:2023-11-01 03:06:06 27 4
gpt4 key购买 nike

我使用下面的代码来播放声音

NSURL* musicFile = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"01" ofType:@"mp3"]]; 
AVAudioPlayer *audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:musicFile error:nil];
[audioPlayer play];

我想在完成时自动重复这个声音文件如何?

最佳答案

audioPlayer.numberOfLoops = someNumber;

或“无限”循环次数:

audioPlayer.numberOfLoops = -1;

关于ios - 自动重复播放,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3560161/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com