重复
重复
  • 发布:2019-07-14 16:38
  • 更新:2019-07-15 23:16
  • 阅读:752

【报Bug】Video控件的error事件在正常播放也会报,且回调中没有说明错误类型

分类:uni-app

详细问题描述

(DCloud产品不会有明显的bug,所以你遇到的问题大都是在特定环境下才能重现的问题,请仔细描述你的环境和重现方式,否则DCloud很难排查解决你的问题)

[内容]
<video id="myVideo" :src="vadfile" :loop="isLoop" :controls="disable" :autoplay="isAuto"
objectFit="fill" @play="onPlay" @ended="onPlayEnd" @waiting="onPlayWait" @timeupdate="onPlayUpdate" @error="onPlayError">
</video>

重现步骤

[步骤]

[结果]

[期望]

[如果语言难以表述清晰,拍一个视频或截图,有图有真相]

IDE运行环境说明

[HBuilder 或 HBuilderX。如果你用其他工具开发uni-app,也需要在此说明]

[IDE版本号]

[windows版本号]

[mac版本号]

uni-app运行环境说明

[运行端是h5或app或某个小程序?]

[运行端版本号]

[项目是cli创建的还是HBuilderX创建的?如果是cli创建的,请更新到最新版cli再试]

[编译模式是老模板模式还是新的自定义组件模式?]

App运行环境说明

[Android版本号]

[iOS版本号]

[手机型号]

[模拟器型号]

附件

[IDE问题请提供HBuilderX运行日志。菜单帮助-查看运行日志,点右键打开文件所在目录,将log文件压缩成zip包上传]

[App问题请提供可重现问题的代码片段,你补充的细一点,问题就解决的快一点]

[App安装包或H5地址]

[可重现代码片段]

联系方式

[QQ]

2019-07-14 16:38 负责人:无 分享
已邀请:
重复

重复 (作者)

上一个播放任务中的视频不存在时,播放下一个存在的视频时@play事件会执行两次

  • CLP

    请提供复现的例子

    2019-07-15 12:49

  • 重复 (作者)

    回复 CLP:

    <template>

    <video id="myVideo" :src="vfile" :loop="isLoop" :controls="disable" :autoplay="isAuto"

    objectFit="fill" @play="onPlay" @pause="onPlayPause" @ended="onPlayEnd" @waiting="onPlayWait" @timeupdate="onPlayUpdate" @error="onPlayError">

    </video>

    </template>


    <script>

    export default {

    data() {

    return {

    videoContext: null,

    isLoop: false,

    disable: false,

    isAuto: true,

    vbase: 'file:///storage/emulated/0/com.test/',//一个安卓根目录下的已有目录

    vlist: [],

    vidx: 0,

    vfile: ''

    }

    },

    onLoad() {

    this.vlist.push(this.vbase + 'test.mp4');//假设这两个文件已存在

    this.vlist.push(this.vbase + '720.mp4');

    },

    onReady: function(res) {

    this.videoContext = uni.createVideoContext('myVideo');

    this.videoContext.hideStatusBar();

    this.playNext();

    },

    methods: {

    playNext(){

    if(this.vlist.length == 0){

    console.log('没有待播放的视频');

    return;

    }

    if(this.vidx > this.vlist.length-1){

    this.vidx = 0;

    }

    this.vfile = this.vlist[this.vidx];

    if(this.vlist.length > 1){

    this.vidx++;

    this.isLoop = false;

    }else{

    this.isLoop = true;

    }

    },

    onPlay(){

    console.log('播放开始事件: ', this.vfile);

    },

    onPlayPause(){

    console.log('播放暂停事件');

    },

    onPlayEnd(){

    console.log('播放结束事件');

    this.count++;

    setTimeout(() => {

    this.playNext()

    }, 500);

    },

    onPlayWait(){


            },  
    onPlayUpdate(){

    },
    onPlayError(e){
    console.log('play error 0', e, this.vfile);//e.target没有内容
    this.playNext()
    }
    }
    }

    </script>


    <style lang="scss">

    video {

    width: 100%;

    height: 100%;

    }

    </style>

    2019-07-15 23:17

  • CLP

    HX的版本是多少?最新版本吗

    2019-07-16 11:22

  • CLP

    你这个是安卓的问题还是iOS的问题

    2019-07-16 11:24

  • 重复 (作者)

    回复 CLP: 2.1.0.20190713

    2019-07-17 00:30

  • 重复 (作者)

    回复 CLP: Android

    2019-07-17 00:31

  • 合肥前端小菜鸡

    回复 重复: 解决了吗

    2022-07-12 17:56

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