PhoneGap:无法在ios中更改html5音频对象的音量 [英] PhoneGap: Unable to change volume of html5 Audio object in ios

查看:95
本文介绍了PhoneGap:无法在ios中更改html5音频对象的音量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在iOS的phonegap中使用javascript中的HTML5音频对象. 在Android中运行正常,但我无法更改音频音量. 我正在使用 phonegap 构建来构建此应用. 我的目标平台是android(等于或大于4)和ios(等于或大于7).

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.

我正在使用以下代码:

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.

我正在使用以下链接作为参考: 我正在使用此链接进行文档编制: http://www.w3schools.com/tags/ref_av_dom.asp http://www.w3schools.com/tags/av_prop_volume.asp

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

推荐答案

@Stack Developer, 在查看您的评论并查看您的参考文档后,我认为谨慎考虑是否支持您的任务.

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

我从 caniuse.com 开始,然后单击.在已知问题下,我看到:

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

  • 卷在iOS上是只读的.
  • Android上的Chrome不支持该规范建议的自动播放.
  • Android上的Chrome不支持根据规范建议的更改播放速率.
  • 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.

这时,您似乎无法在iOS设备上更改 HTML音频的音量.

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

这篇关于PhoneGap:无法在ios中更改html5音频对象的音量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆