关于微信小程序 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.5k
1 个回答

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

推荐问题