Pergunta

It appears that neither volume controls nor mute/unmute work on iPad. Did anyone encounter this problem before? Pretty straightforward functionality, no errors, just silent fail.

var player;
$(document).ready(function () {
    player = new MediaElementPlayer('#player', {});
});
function mute() {
    player.setMuted(true)
    //  player.setVolume(0) does not work either on iPad

}
function unmute() {
    player.setMuted(false)
}

HTML:

 <audio id="player" controls="controls">
<source type="audio/mp3" src="intro.mp3" /> </audio>
Foi útil?

Solução

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top