当前位置: 移动技术网 > IT编程>开发语言>.net > uniapp-微信小程序-ios音乐播放没声音

uniapp-微信小程序-ios音乐播放没声音

2020年07月23日  | 移动技术网IT编程  | 我要评论
const innerAudioContext = uni.createInnerAudioContext();
innerAudioContext.autoplay = true;
innerAudioContext.src = 'https://img-cdn-qiniu.dcloud.net.cn/uniapp/audio/music.mp3';
innerAudioContext.onPlay(() => {
  console.log('开始播放');
});

上述代码在APP,H5,小程序的安卓和ios都正常。唯一有问题就是ios系统在微信小程序音乐播放没声音。
测试机型:iphone6
其他小程序都能正常播放声音,音乐APP都正常。就自己的小程序有问题(泪目坑爹咧)
经过多方的测试,发现可能跟静音有问题。

wx.setInnerAudioOption({	 
  obeyMuteSwitch: false,
});

小程序开启后使用api把静音模式调为不遵循系统静音模式即可
在这里插入图片描述

本文地址:https://blog.csdn.net/qq_32733763/article/details/107429892

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网