错误信息:
wx.setInnerAudioOption is not a function. (In ‘wx.setInnerAudioOption(“obeyMuteSwitch”,!1)’, ‘wx.setInnerAudioOption’ is undefined);at ***** page lifeCycleMethod onLoad function
wx.setInnerAudioOption is not a function;at ***** page lifeCycleMethod onLoad function
Demo
/**
* 页面的初始数据
*/
data: {
innerAudioContext: null,
},
/**
* 生命周期函数–监听页面加载
*/
onLoad: function (options) {
var that = this;
//注册事件放在load中,注册一次即可。
that.data.innerAudioContext = wx.createInnerAudioContext();
that.data.innerAudioContext.volume = 0.3;
wx.setInnerAudioOption(‘obeyMuteSwitch’, false);
that.data.innerAudioContext.onEnded(() => {
console.log(‘自然停止’)
});
},