关于微信小程序 VideoContext.stop() 失效问题

视频播放时
想通过点击某个位置 想视频停止播放
使用 VideoContext.stop() 一点效果都没有

看见有人提供这个思路:

_this.videoContext.seek(0)
_this.videoContext.pause();
/**
   * 点击触发视频播放
   * 
   */
  palyVideo:function(e) {
    let _this = this;
    _this.setData({
      hidden: false,
    });
    _this.videoContext.play();  
  },

  /**
   * 视频停止
   * 
   */
  hiddenVideo:function(e) {
    let _this = this; 
    _this.videoContext.seek(0)
    _this.videoContext.pause();

    // _this.setData({
    //   hidden: true,
    // });

  },


  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function (res) { 
    let _this = this;
    _this.videoContext = wx.createVideoContext('myVideo'); 
  },
阅读 6.4k
1 个回答

开发者工具中无效,真机测试是没问题的

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题