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

核能气质少年 提交于 2019-12-11 10:28:08

问题


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


回答1:


@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.



来源:https://stackoverflow.com/questions/35730579/phonegap-unable-to-change-volume-of-html5-audio-object-in-ios

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!