是否有可能在IOS上控制HTML5音量? [英] Is there any possibility to control HTML5 audio volume on IOS?

查看:572
本文介绍了是否有可能在IOS上控制HTML5音量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用html5音频库 Buzz 将声音添加到浏览器游戏中。有一个用于静音和取消静音的切换按钮,适用于台式机和Android设备。不幸的是,似乎IOS上的音频标签非常有限,所以我无法在Mobile Safari中静音(请参阅 https://developer.apple.com/library/safari/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/Using_HTML5_Audio_Video.pdf ):

I use the html5 audio library Buzz to add sounds to a browser game. There is a toggle button to mute and unmute sound, which works good on desktop and Android devices. Unfortunately it seems like the audio tag is quite limited on IOS, so that I cannot mute audio in Mobile Safari (see https://developer.apple.com/library/safari/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/Using_HTML5_Audio_Video.pdf):


在iOS设备上,音频电平始终在用户的物理控制之下。在JavaScript中无法设置volume属性。读取音量属性始终返回1.

On iOS devices, the audio level is always under the user’s physical control. The volume property is not settable in JavaScript. Reading the volume property always returns 1.

您知道在Mobile Safari中控制html5音频标签音量的任何解决方法吗?

Do you know any workaround to control volume of html5 audio tags in Mobile Safari?

推荐答案

我一直认为动态音量控制和肯定交叉渐变是众所周知的,这是不可能的。苹果已经断言它是如此。除了....显然Kodo Games的人(特别是Nicola Hibbert?)已将其推出并将代码提供给任何人。我刚刚在iOS 8上查看了它。淡入淡出和交叉淡入淡出似乎工作!

I always thought dynamic volume control and certainly crossfading, as we all know, is impossible. Apple has dictated that it be so. Except.... apparently the folk at Kodo Games (specifically Nicola Hibbert?) have pulled it off and made the code available to anyone. I just checked it on iOS 8. Fading and crossfading seem to work!

检查出来(新网站有效): Web Audio API入门

Check it out (new site that works): Getting Started with Web Audio API

这篇关于是否有可能在IOS上控制HTML5音量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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