我只是将新ReplayKit
添加到我的iOS游戏中,并尝试使用startRecordingWithMicrophoneEnabled
开始记录。但是,通过AVAudioPlayer
,游戏的背景音乐将在1或2秒后被杀死。我检查了AVAudioPlayerDelegate
中的所有接口,但没有触发这些接口:
audioPlayerDidFinishPlaying
audioPlayerBeginInterruption
audioPlayerEndInterruption
有人对此有想法吗?
答案 0 :(得分:1)
不知道原因,但找到了一个散步。
我无法说明原因,但似乎工作<?php
$ch = curl_init("http://www.googles123.com/");
// Send request
curl_exec($ch);
// Check for errors and display the error message
if($errno = curl_errno($ch)) {
$error_message = curl_strerror($errno);
echo "cURL error ({$errno}):\n {$error_message}";
}
// Close the handle
curl_close($ch);
?>
实例将变为无效状态而不触发AVAudioPlayer
的任何接口。如此简单地在实例上调用AVAudioPlayerDelegate
/ pause
是没用的。
我尝试过的是杀死正在运行的resume
实例并创建一个新实例,以便在AVAudioPlayer
和startRecordingWithMicrophoneEnabled
的两个回调中再次播放相同的音乐。
音乐可能会暂停几毫秒,但优于沉默。