是否可以在 Adobe AIR 中监控或更改系统音量?
我正在 AS3 / Adobe AIR 中制作一款游戏,要求用户对某些声音做出反应。如果系统音量被静音,有没有办法提前通知用户?另外,有没有办法改变音量?如果没有,是否存在外部跨平台应用程序可以让我监控音量并可以从 Adobe AIR 调用?
I am making a game in AS3 / Adobe AIR that requires the user to react to certain sounds. Is there a way to inform the user up front if the system volume is muted? Moreover, is there a method to change the volume? If not, does an external cross-platform application exist that lets me monitor the volume and that I can call from Adobe AIR?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
本机扩展是一条出路。
您可以按照 Adobe 教程进行操作:http:// www.adobe.com/devnet/air/articles/building-ane-ios-android-pt1.html
或下载现成的:https://github.com/nweber/SystemVolumeNativeExtension
Native Extensions is the way to go.
You can follow an Adobe tutorial: http://www.adobe.com/devnet/air/articles/building-ane-ios-android-pt1.html
Or download them ready made: https://github.com/nweber/SystemVolumeNativeExtension
您对音量的唯一访问权限仅限于应用程序(Flash 播放器或 AIR)。您可以使用
SoundMixer.soundTransform.volume
更改一般音量,或使用SoundChannel.soundTransform.volume
更改特定声音。总而言之,您无法使用 Flash 访问操作系统声音管理器的设置或状态。这就是为什么许多 Flash 网站都会以一条消息开头,要求用户打开扬声器。
The only access you may have to sound volum is restricted to the application (Flash player or AIR). You can change it with
SoundMixer.soundTransform.volume
for the general volume orSoundChannel.soundTransform.volume
for a specific sound.To summerize, you can't access the OS sound manager's settings or state with Flash. That's why many flash websites start with a message asking the users to switch their speakers on.