小程序
小游戏
企业微信
微信支付
扫描小程序码分享
背景情况:
Unity WebGL项目通过使用“微信小游戏团结/Unity适配方案”转换为微信小游戏项目,音频部分通过FMOD管理。
根据Unity WebGL官方文档以及FMOD官方文档,均表明了需要用户交互后才会播放声音,不交互则不播放声音。
根据观察,很多微信小游戏似乎都没有这种限制,进入小游戏后都是可以在无交互的前提下开始播放声音的。
那么具体绕开这个限制的方式是什么呢?
2 个回答
加粗
标红
插入代码
插入链接
插入图片
上传视频
如果真的是这样的话要么你看的游戏用的不是unity,要么音频播放的接口直接用的是微信的音频播放接口
你好,麻烦通过点击下方“反馈信息”按钮,提供出现问题的。
补充一下文档链接:
——————
https://developers.weixin.qq.com/minigame/dev/guide/framework/audio/wxAudioQuickStart.html
https://docs.unity3d.com/Manual/webgl-audio.html
Audio Playback and Browser Security
For security reasons, browsers don’t allow audio playback until an
end user interacts with your application webpage via a mouse click,
touch event or key press. Use a loading screen to allow the end user to
interact with your application and start audio playback before your main
content begins.
FMOD - Platform Details | HTML5 (user interaction requirement)
Most browsers have a user interaction requirement, or audio will not be audible.
This was implemented to stop unscrupulous websites from auto playing audio in things like advertisements.
FMOD output will become audible upon detecting a user interaction.
关注后,可在微信内接收相应的重要提醒。
请使用微信扫描二维码关注 “微信开放社区” 公众号
如果真的是这样的话要么你看的游戏用的不是unity,要么音频播放的接口直接用的是微信的音频播放接口
补充一下文档链接:
——————
https://developers.weixin.qq.com/minigame/dev/guide/framework/audio/wxAudioQuickStart.html
——————
https://docs.unity3d.com/Manual/webgl-audio.html
Audio Playback and Browser Security
For security reasons, browsers don’t allow audio playback until an
end user interacts with your application webpage via a mouse click,
touch event or key press. Use a loading screen to allow the end user to
interact with your application and start audio playback before your main
content begins.
——————
FMOD - Platform Details | HTML5 (user interaction requirement)
User interaction requirement
Most browsers have a user interaction requirement, or audio will not be audible.
This was implemented to stop unscrupulous websites from auto playing audio in things like advertisements.
FMOD output will become audible upon detecting a user interaction.