巡山的小旋风
巡山的小旋风
  • 发布:2023-05-30 21:44
  • 更新:2023-06-18 20:46
  • 阅读:274

【报Bug】在app中 video 播放视频 报错

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: Windows10_19042_508

HBuilderX类型: 正式

HBuilderX版本号: 3.8.3

手机系统: Android

手机系统版本号: Android 11

手机厂商: 华为

手机机型: HUAWEI/DUB-AL00

页面类型: vue

vue版本: vue2

打包方式: 云端

项目创建方式: HBuilderX

示例代码:
<template>  
    <view>  
        <view class="uni-padding-wrap uni-common-mt">  
            <view>  
                <video id="myVideo" src="https://file.im.qcloud.com/download/7d60-shanghai-030-sharedv4-02-1303031839/83e4-1400793973/e528-Rgyvyr48W1/134dbe8ff45301428f38833e879e229d.mp4"  
                    @error="videoErrorCallback" :danmu-list="danmuList" enable-danmu danmu-btn controls></video>  
            </view>  
            <!-- #ifndef MP-ALIPAY -->  
            <view class="uni-list uni-common-mt">  
                <view class="uni-list-cell">  
                    <view>  
                        <view class="uni-label">弹幕内容</view>  
                    </view>  
                    <view class="uni-list-cell-db">  
                        <input v-model="danmuValue" class="uni-input" type="text" placeholder="在此处输入弹幕内容" />  
                    </view>  
                </view>  
            </view>  
            <view class="uni-btn-v">  
                <button @click="sendDanmu" class="page-body-button">发送弹幕</button>  
            </view>  
            <!-- #endif -->  
        </view>  
    </view>  
</template>  
<script>  
export default {  
    data() {  
        return {  
            src: '',  
            danmuList: [{  
                    text: '第 1s 出现的弹幕',  
                    color: '#ff0000',  
                    time: 1  
                },  
                {  
                    text: '第 3s 出现的弹幕',  
                    color: '#ff00ff',  
                    time: 3  
                }  
            ],  
            danmuValue: ''  
        }  
    },  
    onReady: function(res) {  
        // #ifndef MP-ALIPAY  
        this.videoContext = uni.createVideoContext('myVideo')  
        // #endif  
    },  
    methods: {  
        sendDanmu: function() {  
            this.videoContext.sendDanmu({  
                text: this.danmuValue,  
                color: this.getRandomColor()  
            });  
            this.danmuValue = '';  
        },  
        videoErrorCallback: function(e) {  
            uni.showModal({  
                content: e.target.errMsg,  
                showCancel: false  
            })  
        },  
        getRandomColor: function() {  
            const rgb = []  
            for (let i = 0; i < 3; ++i) {  
                let color = Math.floor(Math.random() * 256).toString(16)  
                color = color.length == 1 ? '0' + color : color  
                rgb.push(color)  
            }  
            return '#' + rgb.join('')  
        }  
    }  
}  
</script>

操作步骤:

运行APP基座 播放视频 就报错 播放不了
视频是没有问题的 网页 其他的都可以播放
有些视频连接可以 有些不行
例如 https://file.im.qcloud.com/download/7d60-shanghai-030-sharedv4-02-1303031839/83e4-1400793973/e528-Rgyvyr48W1/134dbe8ff45301428f38833e879e229d.mp4 视频连接就播放不了

预期结果:

能够正常播放

实际结果:

播放视频 报错

{  
    "type": "error",  
    "timeStamp": 1685453918459,  
    "target": {  
        "id": "",  
        "dataset": {},  
        "offsetLeft": 0,  
        "offsetTop": 0  
    },  
    "currentTarget": {  
        "id": "",  
        "dataset": {},  
        "offsetLeft": 0,  
        "offsetTop": 0  
    },  
    "detail": {},  
    "stopPropagation": "function() { [native code] }"  
}  

bug描述:

video 播放视频 报错
视频地址 https://file.im.qcloud.com/download/7d60-shanghai-030-sharedv4-02-1303031839/83e4-1400793973/e528-Rgyvyr48W1/134dbe8ff45301428f38833e879e229d.mp4

{  
    "type": "error",  
    "timeStamp": 1685453918459,  
    "target": {  
        "id": "",  
        "dataset": {},  
        "offsetLeft": 0,  
        "offsetTop": 0  
    },  
    "currentTarget": {  
        "id": "",  
        "dataset": {},  
        "offsetLeft": 0,  
        "offsetTop": 0  
    },  
    "detail": {},  
    "stopPropagation": "function() { [native code] }"  
}  
2023-05-30 21:44 负责人:DCloud_Android_YJC 分享
已邀请:
巡山的小旋风

巡山的小旋风 (作者)

已确认是视频源的问题了

要回复问题请先登录注册