InnerAudioContext.offSeeked
2020-08-26 16:30 更新
解释:取消监听 onSeeked 事件
方法参数
Function callback
示例
图片示例
代码示例
<view class="wrap">
<view class="card-area">
<button type="primary" bindtap="seek">seek</button>
<button type="primary" bindtap="offSeeked">取消监听onSeeked</button>
</view>
</view>
Page({
onLoad() {
const innerAudioContext = swan.createInnerAudioContext();
innerAudioContext.src = 'https://b.bdstatic.com/miniapp/images/yanyuan.mp3';
innerAudioContext.autoplay = false;
innerAudioContext.onPlay(res => {
swan.showModal({
title: 'onPlay',
content: JSON.stringify(res)
});
console.log('onPlay', res);
});
innerAudioContext.onSeeked(res => {
swan.showModal({
title: 'onSeeked',
content: JSON.stringify(res)
});
});
this.innerAudioContext = innerAudioContext;
this.innerAudioContext.play();
},
seek() {
this.innerAudioContext.seek(80);
},
offSeeked() {
swan.showModal({
title: 'offSeeked',
content: '取消监听成功'
});
this.innerAudioContext.offSeeked();
}
});
以上内容是否对您有帮助:
更多建议: