uniapp V3编译模式下video组件报错问题
uni.createVideoContext返回的对象不一致导致报错。如附件图,分别是V3编译模式返回的及普通编译模式返回的对象,报错信息如图

v3编译模式返回的对象如图

·回复
这是视频组件的代码,然后我在另外一个组件里面引入后点击播放文字按钮会报错,但是点击视频上的播放按钮可以正常播放
<template>      <div>  
        <video id='video1' class="video" :src="src" autoplay="false" duration="" controls="true" :danmu-list="list"  
            danmu-btn="true" enable-danmu="true" :loop="true" muted="true" initial-time="" direction="-90"  
            show-mute-btn="true" @timeupdate="timeupdate" @fullscreenchange="fullscreenchange"></video>  
        <button class="btn" @click="play">播放</button>  
        <button class="btn" @click="pause">暂停</button>  
        <button class="btn" @click="seek">跳转到指定位置</button>  
        <button class="btn" @click="stop">停止</button>  
        <button class="btn" @click="fullScreen">全屏</button>  
        <button class="btn" @click="exitFullScreen">退出全屏</button>  
        <button class="btn" @click="playbackRate">设置倍速</button>  
        <button class="btn" @click="sendDanmu">发送弹幕</button>  
    </div>  
</template>  
<script>  
    export default {  
        data: {  
            src: "https://img.cdn.aliyun.dcloud.net.cn/guide/uniapp/%E7%AC%AC1%E8%AE%B2%EF%BC%88uni-app%E4%BA%A7%E5%93%81%E4%BB%8B%E7%BB%8D%EF%BC%89-%20DCloud%E5%AE%98%E6%96%B9%E8%A7%86%E9%A2%91%E6%95%99%E7%A8%8B@20181126-lite.m4v",  
            fil: true,  
            list: [{  
                text: '要显示的文本',  
                color: '#FF0000',  
                time: 9  
            }]  
        },  
        onReady() {  
            this.context = uni.createVideoContext("video1", this);  
        },  
        methods: {  
            play() {  
                this.context.play();  
            },  
            pause() {  
                this.context.pause();  
            },  
            seek() {  
                this.context.seek(20);  
            },  
            stop() {  
                this.context.stop();  
            },  
            fullScreen() {  
                this.context.requestFullScreen({  
                    direction: 90  
                });  
            },  
            exitFullScreen() {  
                this.context.exitFullScreen();  
            },  
            sendDanmu() {  
                this.context.sendDanmu({  
                    text: '要显示的弹幕文本',  
                    color: '#FF0000'  
                });  
            },  
            playbackRate() {  
                this.context.playbackRate(2);  
            }  
        }  
    }  
</script>  
<style>  
    .video {  
        width: 750rpx;  
        height: 400rpx;  
        background-color: #808080;  
    }  
    .btn {  
        margin-top: 5px;  
        margin-bottom: 5px;  
        ;  
    }  
</style>  
·回复
官方示例的调用createVideoContext这个方法返回的值和我代码调用createVideoContext这个方法返回的值,
经过对比后发现少了一些方法,如:play(),pause()等方法
·回复
我这边也出现同样的问题,希望官方能尽快修复。
·回复
升级到2.6.6-alpha试试。
以上是 uniapp V3编译模式下video组件报错问题 的全部内容, 来源链接: utcz.com/a/13126.html








