X
Tap here to go to the mobile version of the site.

Support Forum

HTML5 Audio(), volume control does not work

Posted

Hello,

I'm using firefox 26.0.

I'm making an app using the HTML5 Audio fonctionnality. First thing, I'm not using the <audio> tag from HTML5.

Here is a small part of my code :

var audio = new Audio(); audio.src = 'music/Vivaldi.mp3'; audio.controls = true; audio.autoplay = true; audio.volume = 1;

If I change the volume property, it works.

But, as soon as I use createMediaElementSource(audio) The "volume" property does not work (http://www.w3schools.com/tags/av_prop_volume.asp). If I change the value, nothing happen...


The weird thing is that it works perfectly on Chrome, Safari & even on IE...


Edit : It look like a known bug : https://bugzilla.mozilla.org/show_bug.cgi?id=944924

Hello, I'm using firefox 26.0. I'm making an app using the HTML5 Audio fonctionnality. First thing, I'm not using the <audio> tag from HTML5. Here is a small part of my code : var audio = new Audio(); audio.src = 'music/Vivaldi.mp3'; audio.controls = true; audio.autoplay = true; audio.volume = 1; If I change the volume property, it works. But, as soon as I use createMediaElementSource(audio) The "volume" property does not work (http://www.w3schools.com/tags/av_prop_volume.asp). If I change the value, nothing happen... The weird thing is that it works perfectly on Chrome, Safari & even on IE... Edit : It look like a known bug : https://bugzilla.mozilla.org/show_bug.cgi?id=944924

Modified by TatsuKan

Chosen solution

Until the bug is fixed, you can control audio volume using GainNode (since you already use Web Audio API) as explained here: http://www.html5rocks.com/en/tutorials/webaudio/intro/#toc-volume Make sure the audio.volume is set to 1 before you create MediaElementSource. Now you can control a value of the gain node instead of audio.volume. However it won't change the representation of the native audio element.

Read this answer in context 1

Additional System Details

Application

  • User Agent: Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36

More Information

guigs
  • Top 10 Contributor
  • Administrator
  • Moderator
801 solutions 9087 answers

Hi TatsuKan,

Thank you for contacting Mozilla support. From the looks of the code, compared to the "try it yourself" of the w3 schools you are using different elements.

The CreateMediaElementSource(audio) is a problem with the source of the video. Reference: http://stackoverflow.com/questions/20.../createmediaelementsource-method-of-web-audio-api-in-firefox

Do you have an example page where this is happening?

Hi TatsuKan, Thank you for contacting Mozilla support. From the looks of the code, compared to the "try it yourself" of the w3 schools you are using different elements. The CreateMediaElementSource(audio) is a problem with the source of the video. Reference: [http://stackoverflow.com/questions/20469190/createmediaelementsource-method-of-web-audio-api-in-firefox] Do you have an example page where this is happening?

Question owner

Hi,

There is a link in my first message that describe exactly my problems, with 2 examples.

https://bugzilla.mozilla.org/show_bug.cgi?id=944924

Hi, There is a link in my first message that describe exactly my problems, with 2 examples. https://bugzilla.mozilla.org/show_bug.cgi?id=944924
guigs
  • Top 10 Contributor
  • Administrator
  • Moderator
801 solutions 9087 answers

Currently it looks like this bug depends on a P1 bug, which is the highest priority. I have voted on this bug and recommend you check for updates on this issue on this bug and vote as well because it is affecting you. In the meantime we are happy to help find a work around.

Can you also check to see if this is still happening in Nightly on your computer? http://nightly.mozilla.org/

Does the audio load if you press past the 0:01 time on the video player?

We are very sorry for the inconvenience. If there are any other questions in the meantime please do not hesitate.

Currently it looks like this bug depends on a P1 bug, which is the highest priority. I have voted on this bug and recommend you check for updates on this issue on this bug and vote as well because it is affecting you. In the meantime we are happy to help find a work around. Can you also check to see if this is still happening in Nightly on your computer? [http://nightly.mozilla.org/] Does the audio load if you press past the 0:01 time on the video player? We are very sorry for the inconvenience. If there are any other questions in the meantime please do not hesitate.

Modified by guigs

Juribiyan 1 solutions 1 answers

Chosen Solution

Until the bug is fixed, you can control audio volume using GainNode (since you already use Web Audio API) as explained here: http://www.html5rocks.com/en/tutorials/webaudio/intro/#toc-volume Make sure the audio.volume is set to 1 before you create MediaElementSource. Now you can control a value of the gain node instead of audio.volume. However it won't change the representation of the native audio element.

Until the bug is fixed, you can control audio volume using GainNode (since you already use Web Audio API) as explained here: http://www.html5rocks.com/en/tutorials/webaudio/intro/#toc-volume Make sure the audio.volume is set to ''1'' before you create MediaElementSource. Now you can control a value of the gain node instead of audio.volume. However it won't change the representation of the native audio element.