Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

volume off does not work in html5 video ipad 2

volume off does not work in html5 video ipad 2.

player = document.getElementById(element_id);
if (player.muted){
    player.muted = false;
    player.volume = 1;
    //player.volume(1);
}else{
    player.muted = true;
    player.volume = 0;
    //player.volume(0);
}
like image 306
Ivan Avatar asked Apr 10 '13 06:04

Ivan


Video Answer


1 Answers

I'm afraid iOS does not allow changing the volume with Javascript. From Apple's documentation (emphasis is mine):

On the desktop, you can set and read the volume property of an or element. This allows you to set the element’s audio volume relative to the computer’s current volume setting. A value of 1 plays sound at the normal level. A value of 0 silences the audio. Values between 0 and 1 attenuate the audio.

This volume adjustment can be useful, because it allows the user to mute a game, for example, while still listening to music on the computer.

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.

There is no mention of the muted property, but experimenting shows that it can't be changed either: http://jsbin.com/anikab/1/

like image 71
brianchirls Avatar answered Sep 28 '22 01:09

brianchirls