InnerAudioContext.offSeeked

解释:取消监听 onSeeked 事件

方法参数

Function callback

示例

在开发者工具中预览效果

扫码体验

请使用百度APP扫码

图片示例

代码示例

-

  1. <view class="container"> <view class="card-area"> <button type="primary" bindtap="seek">seek</button> <button type="primary" bindtap="offSeeked">offSeeked</button> </view></view>

-

  1. Page({ onLoad() { const innerAudioContext = swan.createInnerAudioContext(); innerAudioContext.src = 'https://vd3.bdstatic.com/mda-ic7mxzt5cvz6f4y5/mda-ic7mxzt5cvz6f4y5.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) }); }); innerAudioContext.onEnded(res => { innerAudioContext.offSeeked(); }); this.innerAudioContext = innerAudioContext; this.innerAudioContext.play(); }, seek() { this.innerAudioContext.seek(80); }, offSeeked(){ swan.showModal({ title: 'offSeeked', content: '取消监听成功' }); this.innerAudioContext.offSeeked(); }});