0

似乎音量控制和静音/取消静音都不能在 iPad 上工作。以前有人遇到过这个问题吗?非常简单的功能,没有错误,只是静默失败。

var 播放器;
$(文档).ready(函数 () {
    player = new MediaElementPlayer('#player', {});
});
功能静音(){
    player.setMuted(真)
    // player.setVolume(0) 在 iPad 上也不起作用

}
功能取消静音(){
    player.setMuted(假)
}

HTML:

 <audio id="player" controls="controls">
<source type="audio/mp3" src="intro.mp3" /> </audio>
4

1 回答 1

0

Nevermind. Since MediaElement.js uses native <audio> controls on iPad, according to Safari HTML5 Audio and Video guide, it is not possible to control HTML5 audio volume via script:

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.

https://developer.apple.com/library/safari/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/Device-SpecificConsiderations/Device-SpecificConsiderations.html

... need to program a workaround for iPads.

于 2013-10-21T19:57:51.167 回答