a***@iclip365.com
a***@iclip365.com
  • 发布:2023-10-16 11:36
  • 更新:2023-10-21 17:57
  • 阅读:190

【报Bug】video 最近无法播放视频

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Windows

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

HBuilderX类型: 正式

HBuilderX版本号: 3.8.4

手机系统: Android

手机系统版本号: Android 12

手机厂商: OPPO

手机机型: OPPO A53 5G

页面类型: vue

vue版本: vue2

打包方式: 云端

项目创建方式: HBuilderX

示例代码:
<template> <view class="video-play"> <scs-loading v-if="isLoading"></scs-loading> <video controls v-if="videoUrl" id="myvideo" src="videoUrl" @error="videoErrorCallback"
@fullscreenchange="screenChange"
></video>
</view>
</template>

<script>
export default {
data(){
return {
videoUrl: '',
isLoading: false
}
},
onLoad(e) {
let self = this
self.videoUrl = e.url;
self.isLoading = true
setTimeout(() => {
self.play()
},2000)
},
methods: {
videoErrorCallback: function (e) {
console.log('视频错误信息:'+ this.videoUrl)
console.log(e)
},
play(){
let videoContext = uni.createVideoContext("myvideo", this); // this这个是实例对象 必传
videoContext.requestFullScreen({ direction: 0 });
videoContext.play();
this.isLoading = false
},
screenChange(e) {
let fullScreen = e.detail.fullScreen; // 值true为进入全屏,false为退出全屏
if (!fullScreen) {
//退出全屏
uni.navigateBack({
delta: 1,
})
}
},
}
}
</script>

<style lang="less">
.video-play{
video{
width: 100%;
height: 100%;
}
}
</style>

操作步骤:

视频地址 https://imgs.scs.work/scs/20231016/3ed2cfef133844ec87084dc9fedd3daa.mp4 播放视频

预期结果:

可以播放视频

实际结果:

无法播放

bug描述:

视频地址 https://imgs.scs.work/scs/20231016/3ed2cfef133844ec87084dc9fedd3daa.mp4
错误提示:
{
"type": "error",
"target": {
"dataset": {},
"id": "",
"offsetLeft": 0,
"offsetTop": 15
},
"detail": {},
"currentTarget": {
"dataset": {},
"id": "",
"offsetLeft": 0,
"offsetTop": 15
},
"timeStamp": 0,
"preventDefault": "function() { [native code] }",
"stopPropagation": "function() { [native code] }",
"mp": {
"@warning": "mp is deprecated",
"type": "error",
"target": {
"dataset": {},
"id": "",
"offsetLeft": 0,
"offsetTop": 15
},
"detail": {},
"currentTarget": {
"dataset": {},
"id": "",
"offsetLeft": 0,
"offsetTop": 15
},
"timeStamp": 0,
"preventDefault": "function() { [native code] }",
"stopPropagation": "function() { [native code] }"
},
"_processed": true
}

2023-10-16 11:36 负责人:无 分享
已邀请:
喜欢技术的前端

喜欢技术的前端 - QQ---445849201

可以正常播放  
<template>  
    <view class="content">  
        <video src="https://imgs.scs.work/scs/20231016/3ed2cfef133844ec87084dc9fedd3daa.mp4"></video>  
    </view>  
</template>  

<script>  
    export default {  
        data() {  
            return {  
                videoUrl: '',  
                isLoading: false  
            }  
        },  
        onLoad(e) {  
            let self = this  
            self.videoUrl = e.url;  
            self.isLoading = true  
            setTimeout(() => {  
                self.play()  
            }, 2000)  
        },  
        methods: {  
            videoErrorCallback: function(e) {  
                console.log('视频错误信息:' + this.videoUrl)  
                console.log(e)  
            },  
            play() {  
                let videoContext = uni.createVideoContext("myvideo", this); // this这个是实例对象 必传   
                videoContext.requestFullScreen({  
                    direction: 0  
                });  
                videoContext.play();  
                this.isLoading = false  
            },  
            screenChange(e) {  
                let fullScreen = e.detail.fullScreen; // 值true为进入全屏,false为退出全屏   
                if (!fullScreen) { //退出全屏   
                    uni.navigateBack({  
                        delta: 1,  
                    })  
                }  
            },  
        }  
    }  
</script>  
<style lang="scss">  
    .video-play {  
        video {  
            width: 100%;  
            height: 100%;  
        }  
    }  
</style>

要回复问题请先登录注册