iOS真机运行video组件问题
发布于 5 年前 作者 fangchen 7639 次浏览 来自 问答
  • 当前 Bug 的表现(可附上截图)
    在调用video的pause()时,暂停视频,然后通过play()方法播放视频,视频并不是从暂停位置播放,而是从头播放

  • 预期表现

在调用pause()暂停视频时,再调用play()方法,可以继续从暂停位置播放视频

  • 复现路径
  • 提供一个最简复现 Demo

<video src=’{{item.videoPath}}’ class=‘video-box’ autoplay="{{autoplay}}" controls="{{controls}}" wx:if="{{isHas}}" id=‘currentVideo’ bindtimeupdate=“timeUpdate” initial-time="{{initialTime}}" bindpause=“bindpause”></video>

timeUpdate(e){

// console.log(e.detail.currentTime)

var that = this;

aa = e.detail.currentTime

console.log(“初始视频”,aa)

},

bindpause(e){

console.log(e)

},

stopVideo(){

console.log(“停止视频”)

var that = this;

var videoObj = wx.createVideoContext(“currentVideo”, that)

videoObj.pause();

that.setData({

isHas: false,

isShowBtn: true

})

},

playVideo(){

var that = this;

var videoObj = wx.createVideoContext(“currentVideo”,that)

that.setData({

isHas:true,

initialTime:aa

})

let time = setTimeout(function () {

that.setData({

isShowBtn: false

})

}, 600)

videoObj.play();

},

1 回复

麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)

回到顶部