InnerAudioContext.offSeeked

解释:取消监听 onSeeked 事件

方法参数

Function callback

示例

在开发者工具中预览效果

扫码体验

InnerAudioContext.offSeeked - 图1请使用百度APP扫码

图片示例

InnerAudioContext.offSeeked - 图2

InnerAudioContext.offSeeked - 图3

InnerAudioContext.offSeeked - 图4

代码示例

  • 在 swan 文件中
  1. <view class="container">
  2. <view class="card-area">
  3. <button type="primary" bindtap="seek">seek</button>
  4. <button type="primary" bindtap="offSeeked">offSeeked</button>
  5. </view>
  6. </view>
  • 在 js 文件中
  1. Page({
  2. onLoad() {
  3. const innerAudioContext = swan.createInnerAudioContext();
  4. innerAudioContext.src = 'https://vd3.bdstatic.com/mda-ic7mxzt5cvz6f4y5/mda-ic7mxzt5cvz6f4y5.mp3';
  5. innerAudioContext.autoplay = false;
  6. innerAudioContext.onPlay(res => {
  7. swan.showModal({
  8. title: 'onPlay',
  9. content: JSON.stringify(res)
  10. });
  11. console.log('onPlay', res);
  12. });
  13. innerAudioContext.onSeeked(res => {
  14. swan.showModal({
  15. title: 'onSeeked',
  16. content: JSON.stringify(res)
  17. });
  18. });
  19. innerAudioContext.onEnded(res => {
  20. innerAudioContext.offSeeked();
  21. });
  22. this.innerAudioContext = innerAudioContext;
  23. this.innerAudioContext.play();
  24. },
  25. seek() {
  26. this.innerAudioContext.seek(80);
  27. },
  28. offSeeked(){
  29. swan.showModal({
  30. title: 'offSeeked',
  31. content: '取消监听成功'
  32. });
  33. this.innerAudioContext.offSeeked();
  34. }
  35. });