3

So it seems like setVolume() for html5 audio doesn't work at all on both Android stock browser and Mobile Safari. Here's a test case.

Is there any further evidence to this, an open issue or perhaps even a workaround (apart from resorting to Flash for android)?

Ronny
  • 4,295
  • 2
  • 24
  • 30

2 Answers2

4

From the Safari HTML5 Audio and Video guide:

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.

On all other devices you can also set the muted property to true.

Brian Hadaway
  • 1,875
  • 14
  • 23
  • Thanks, sucks to know but I guess this is why some other mobile devices doesn't support this as well. For reference, [here's a list](https://github.com/happyworm/jPlayer/blob/master/jquery.jplayer/jquery.jplayer.js#L308) of those UAs I found in jPlayer's source code. – Ronny Apr 01 '12 at 10:00
0

On Android you can set the volume property and it works in the native browser but not in Chrome.

Try this...

var audio1 = new Audio(); 
audio1.src = "test.mp3";
audio1.volume = 0.3;
audio1.play();
Tim Goss
  • 261
  • 3
  • 5