Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

微信内网页自动播放音频 #137

Closed
Dream4ever opened this issue Feb 7, 2021 · 0 comments
Closed

微信内网页自动播放音频 #137

Dream4ever opened this issue Feb 7, 2021 · 0 comments
Labels
Wechat The popular social app

Comments

@Dream4ever
Copy link
Owner

Dream4ever commented Feb 7, 2021

实现方法

参考链接:ufologist/autoplay-audio-ios.html

if (window.WeixinJSBridge) {
  WeixinJSBridge.invoke('getNetworkType', {}, function (e) {
    audio.play()
  }, false)
} else {
  document.addEventListener("WeixinJSBridgeReady", function () {
    WeixinJSBridge.invoke('getNetworkType', {}, function (e) {
      audio.play()
    })
  }, false)
}
audio.play()

效果测试

iOS 系统找了四五个用户测试,只有一个用户的微信不自动播放音频,系统还是此刻(2022-01-24)的最新版 15.2.1。

Android 系统也找了好几个用户测试,只有一个小米手机能够自动播放音频。

注意事项

但是根据官方通知 Android微信内网页音频自动播放能力调整,说是从2020年4月起,微信内网页就无法自动播放音频了。虽然目前(2021年02月07日)还可以,但是不知道什么时候会强制禁止。

@Dream4ever Dream4ever added the Wechat The popular social app label Feb 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Wechat The popular social app
Projects
None yet
Development

No branches or pull requests

1 participant