InnerAudioContext.offWaiting
收藏
我的收藏

基础库 1.0.0 开始支持本方法,这是一个同步方法。​
取消 InnerAudioContext.onWaiting 监听的事件。​

语法​

InnerAudioContext.offWaiting(callback)

参数说明​

callback​

类型​
默认值​
必填​
说明​
最低支持版本​
function​
否​
取消监听音频加载中事件的回调。没有 callback 则取消所有的监听音频加载中事件的回调,有 callback 则只取消对应的监听回调​
1.0.0​

返回值​

无​

扫码体验​

代码示例​

<view> <button bindtap="play">play</button> <button bindtap="pause">pause</button> <button bindtap="stop">stop</button> <button bindtap="seek">seek</button> </view>
Page({ data: { innerAudioCtx: undefined, }, onLoad() { const innerAudioCtx = tt.createInnerAudioContext() innerAudioCtx.src = "https://sf1-cdn-tos.douyinstatic.com/obj/microapp/frontend/sdk/0000-0001.mp3" innerAudioCtx.obeyMuteSwitch = false this.innerAudioCtx = innerAudioCtx innerAudioCtx.onCanplay(() => { console.log("onCanplay") }) innerAudioCtx.onPlay(() => { console.log("onPlay") }) innerAudioCtx.onPause(() => { console.log("onPause") }) innerAudioCtx.onStop(() => { console.log("onStop") }) innerAudioCtx.onError((res) => { console.log(res) }) innerAudioCtx.onEnded(() => { console.log("onEnded") }) innerAudioCtx.onWaiting(() => { console.log("onWaiting") }) innerAudioCtx.onSeeking(() => { console.log("onSeeking") }) innerAudioCtx.onSeeked(() => { console.log("onSeeked") }) innerAudioCtx.onTimeUpdate(() => { console.log("onTimeUpdate") }) }, onUnload() { const innerAudioCtx = this.innerAudioCtx if (innerAudioCtx) { innerAudioCtx.offCanplay() innerAudioCtx.offPlay() innerAudioCtx.offPause() innerAudioCtx.offStop() innerAudioCtx.offError() innerAudioCtx.offEnded() innerAudioCtx.offWaiting() innerAudioCtx.offSeeking() innerAudioCtx.offSeeked() innerAudioCtx.offTimeUpdate() innerAudioCtx.destroy() } }, play() { this.innerAudioCtx.play() }, pause() { this.innerAudioCtx.pause() }, stop() { this.innerAudioCtx.stop() }, seek() { this.innerAudioCtx.seek(3) }, })

Bug & Tip​

无​