addeventlistener("volumechange", ...) 在 ios 上工作吗?
Does addeventlistener("volumechange", ...) work on ios?
我目前正在开发 PWA。尝试检测用户何时按下 ios 上的提高音量或降低音量按钮以触发我的回调函数。然而,它似乎不起作用。
document.querySelector(".audioElement").addEventListener("volumechange", function () { code block })
不,你不能在 iOS 上使用它,因为音量 属性 总是 returns 1.
On iOS devices, the audio level is always under the user’s physical control. The volume property is not settable in JavaScript. Reading the volume property always returns 1.
我目前正在开发 PWA。尝试检测用户何时按下 ios 上的提高音量或降低音量按钮以触发我的回调函数。然而,它似乎不起作用。
document.querySelector(".audioElement").addEventListener("volumechange", function () { code block })
不,你不能在 iOS 上使用它,因为音量 属性 总是 returns 1.
On iOS devices, the audio level is always under the user’s physical control. The volume property is not settable in JavaScript. Reading the volume property always returns 1.