현재 재생 중이며 다시 재생할 경우 플레이어를 재설정하려는 AVAudioPlayer를 사용하는 데 문제가 있습니다.AVAudioPlayer 현재 재생중인 사운드를 재설정하고 처음부터 재생합니다.
나는 행운과 함께 다음과 같은 시도 :
이소리 한 번 재생하지만 난 그 소리를 중지 버튼을 선택 두 번째 시간, 세 번째 다시 소리를 시작합니다. 나는 또한 작동하지 않았다 플레이어를 재설정 할 나타냅니다 player.currentTime = 0을 사용하려고했습니다
//Stop the player and restart it
if (player.playing) {
NSLog(@"Reset sound: %@", selectedSound);
[player stop];
[player play];
} else {
NSLog(@"playSound: %@", selectedSound);
[player play];
}
는 또한 currentTime을 = 0을 재설정 한 후 작동하지 않았다 플레이를 호출했습니다.
//Stop the player and restart it
if (player.playing) {
NSLog(@"Reset sound: %@", selectedSound);
player.currentTime = 0;
[player play];
} else {
NSLog(@"playSound: %@", selectedSound);
[player play];
}
FWIW, 방금 제로로 currentTime을 설정하는 것이 좋다고 보았다. 여기에 설명 된 방법을 사용하면 오디오를 몇 번 빠르게 연주 한 후 재생하는 것을 거부합니다. – Plumenator