简体   繁体   English

PhoneGap:无法在 ios 中更改 html5 Audio 对象的音量

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

I am using HTML5 Audio object in javascript with phonegap for iOS.我在 javascript 中使用 HTML5 Audio 对象和 iOS 的 phonegap。 It's working fine in Android but I am not able to change volume of audio.它在 Android 中运行良好,但我无法更改音频音量。 I am using phonegap build to build this app.我正在使用phonegap build 来构建这个应用程序。 My target platforms are android ( equal or greater than 4 ) and ios ( equal or greater than 7).我的目标平台是 android(等于或大于 4)和 ios(等于或大于 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我使用以下链接作为参考:我使用此链接作为文档: 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谢谢

@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. @Stack 开发人员,在查看您的评论并查看您的参考文档后,我认为查看是否有支持您的任务是明智的。

I started with caniuse.com and clicked "audio elements" in the HTML5 section.我从caniuse.com开始,然后单击 HTML5 部分中的“音频元素” Under known issues I see:在已知问题下,我看到:

  • Volume is read-only on iOS.卷在 iOS 上是只读的。
  • Chrome on Android does not support autoplay as advised by the specification.根据规范的建议,Android 上的 Chrome 不支持自动播放。
  • Chrome on Android does not support changing playbackrate as advised by the specification. Android 上的 Chrome 不支持按照规范的建议更改播放速率。

At this time, it appears you cannot change the volume for HTML Audio on iOS devices.目前,您似乎无法在 iOS 设备上更改HTML 音频的音量。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM