Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
372 views
in Technique[技术] by (71.8m points)

javascript - PhoneGap:无法在ios中更改html5音频对象的音量(PhoneGap: Unable to change volume of html5 Audio object in ios)

I am using HTML5 Audio object in javascript with phonegap for iOS.

(我在带有iOS的phonegap的javascript中使用HTML5音频对象。)

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构建来构建此应用。)

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

(谢谢)

  ask by Stack Developer translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

@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 Developer,在对您的评论进行审阅以及在对参考文档进行审阅之后,我认为谨慎考虑是否支持您的任务。)

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音频的音量。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...