预计:
当 audioplayer.play(atTime: 1) 被调用时,计时器重置为 0,并且在第一秒播放音频播放器
现实:
我尝试了 delay = 0.000000001, 1, 100000000,但无论如何,都不会播放噪音。然而,代码被清楚地执行了(因为“函数被调用”出现在控制台中)
为什么会出现差异?
C = AVAudioPlayer() // assume other setups are done
C.play(atTime: 1)
print("function was called")
Run Code Online (Sandbox Code Playgroud) With my iPad's iOS Safari, I can use Daily.co's video API to call other devices. But the moment I start recording my local microphone via the audio-recorder-polyfill library , everybody else will no longer be able to hear me, even though I can still hear them and share my camera. Even when the recording session ends, the audio call remains broken (though the audio-recorder works successfully).
It seems iOS specific, because I have no problems with my Surface's Windows …
mobile-safari audio-streaming video-conferencing web-mediarecorder webrtc-ios
预期行为:
对于 i = 0,打印语句在 0 秒后调用。
对于 i = 1,1.1 秒后调用打印语句
对于 i = 2,打印语句在 2.2 秒后调用
实际行为:
分别在 0、1、2、3 秒后调用打印语句,即忽略内部延迟函数。
那么为什么会出现差异呢?
for i in 0...3 {
DispatchQueue.main.asyncAfter(deadline: .now() + .seconds(i), execute: {
DispatchQueue.main.asyncAfter(deadline: .now() + .seconds(i/10), execute: {
print("function was called")
})
})
}
Run Code Online (Sandbox Code Playgroud)