3***@qq.com
3***@qq.com
  • 发布:2019-01-22 23:03
  • 更新:2021-03-25 16:33
  • 阅读:2319

【报Bug】H5端video组件 设置初始播放位置不生效

分类:uni-app

seek好像也没效果

2019-01-22 23:03 负责人:无 分享
已邀请:
z***@163.com

z***@163.com - 软件开发

到现在10月份了,还是没效果,怎么没人解决和回答啊?

  • DCloud_UNI_GSQ

    测试initial-time属性和seek方法均正常,请提供一个复现问题的示例

    2019-11-02 16:15

  • z***@163.com

    回复 DCloud_UNI_GSQ: 我现在测试了,点播放的话就能跳转到播放位置。如何能不点播放就到播放位置,要不以为还是从头看呢。还有个问题咨询一下,咱们这个能显示视频当前播放位置的截图么?

    2019-12-06 16:02

  • DCloud_UNI_GSQ

    回复 z***@163.com: 可以尝试设置封面

    2019-12-10 12:01

  • 2***@qq.com

    回复 DCloud_UNI_GSQ:

    每次 timeupdate 的时候把时间当前视频的播放时间记录在 localStorage 里面,下次来播放的时候查一下,如果这个视频可以查到上次播放进度的话,就直接跳转到上次保存的记录时间上接着播放,在 chrome 中可以工作,在微信中打开H5不起效


    <video  
    id="myVideo"
    style="width:100%; max-width:750upx"
    x5-video-player-type="h5"
    :show-fullscreen-btn="false"
    object-fit="fill"
    :src="videoPath"
    @play="play"
    @error="videoErrorCallback"
    @loadedmetadata="loadedmetadata"
    @timeupdate="timeupdate"
    ></video>

    js method


    play() {  
    console.log('play')
    this.userPlay = true
    // uni.setStorageSync('video_user_play',)
    const key = `video_${this.currChapterId}_${this.currItemId}`
    let { currentTime } = uni.getStorageSync(key)
    if (currentTime) {
    currentTime = Math.floor(currentTime)
    uni.showToast({
    icon: 'none',
    title: `上次播放到第 ${currentTime} 秒`,
    })
    this.videoContext.seek(currentTime)
    }
    },
    timeupdate(e) {
    // 视频播放变化
    let { currentTime, duration } = e.detail
    if (!duration) return

    // TODO user login
    if (currentTime > 60 && false) {
    this.videoContext.seek(0)
    }

    const key = `video_${this.currChapterId}_${this.currItemId}`
    const toEnd = duration - currentTime
    console.log('timeupdate', { currentTime, duration, toEnd })
    uni.setStorageSync(key, {
    currentTime,
    toEnd,
    })
    },

    2020-07-16 21:39

2***@qq.com

2***@qq.com

seek 微信H5 中不起效

  • DCloud_UNI_GSQ

    微信浏览器中吗?微信浏览器拦截了第三方页面webview的video组件,改用微信自己定制的原生视频播放器播放,有一些限制。

    2020-07-22 18:49

  • 2***@qq.com

    回复 DCloud_UNI_GSQ: 是的

    2020-07-29 17:42

minely

minely

请问这个问题解决了吗?
现在3.1.4的版本,在安卓机上 :initial-time="20"、this.videoContext.seek(20);动态设置都无效,在ios上生效;微信开发者工具也有用,就手机无用

该问题目前已经被锁定, 无法添加新回复