Stack Developer
Stack Developer

Reputation: 133

PhoneGap: Unable to change volume of html5 Audio object in ios

I am using HTML5 Audio object in javascript with phonegap for iOS. It's working fine in Android but I am not able to change volume of audio. I am using phonegap build to build this app. My target platforms are android ( equal or greater than 4 ) and ios ( equal or greater than 7).

This is my first app but I am working on this for around one month but I am still not that much good that's why I stuck on the volume issue.

I am using following code:

var my_audio = new Audio('test.mp3');
my_audio.play();
my_audio.volume=0.4;
console.log(my_audio.volume); // this still outputs 1

As you noticed above that volume did not change.

I am using following links for reference: I am using this links for documentation: http://www.w3schools.com/tags/ref_av_dom.asp http://www.w3schools.com/tags/av_prop_volume.asp

Can anybody guide that how to overcome this issue?

Any response will be appreciated. Thanks

Upvotes: 1

Views: 1153

Answers (1)

user3255670
user3255670

Reputation:

@Stack Developer, in review of you comments and after reviewing your reference document, I thought it would be prudent to see if there was support for your task.

I started with caniuse.com and clicked "audio elements" in the HTML5 section. Under known issues I see:

  • Volume is read-only on iOS.
  • Chrome on Android does not support autoplay as advised by the specification.
  • Chrome on Android does not support changing playbackrate as advised by the specification.

At this time, it appears you cannot change the volume for HTML Audio on iOS devices.

Upvotes: 2

Related Questions