uni-app nuve播放器页面,video组件更换src方法地址之后,低版本安卓(6,7)视频画面黑屏

tpgth1q7  于 2021-11-27  发布在  Java
关注(0)|答案(1)|浏览(1077)

问题描述

视频播放器,先点击播放一个视频,然后在更换播放地址就会报下边的错误,然后视频画面黑屏。
reportJSException >>>> exception function:draw android view, exception:WX_RENDER_ERR_LAYER_OVERFLOWLayer overflow limit error: 14 layers!

复现步骤

[复现问题的步骤]

  1. 官方hello-uni项目,修改了nvue的视频播放页,具体可查看代码

预期结果

可以切换播放地址,并且不黑屏。3.2.9.20210927是正常的

实际结果

测试第一次播放会黑屏报错,第二次播放正常显示。

系统信息:

  • 发行平台:安卓和iOS
  • 操作系统Android 6.0.1 Android 7.0
  • HBuilderX版本 3.2.12

补充信息

[可选]
[根据你的分析,出现这个问题的原因可能在哪里?]

anhgbhbe

anhgbhbe1#

<template>
    <div>
        <video id='video1' class="video" :src="src" autoplay="false" duration="" :controls="controls" :danmu-list="list"
            danmu-btn="true" enable-danmu="true" :loop="true" muted="true" initial-time="" direction="-90"
            show-mute-btn="true" @play="onstart" @pause="onpause" @ended="onfinish" @error="onfail" @waiting="waiting"
            @timeupdate="timeupdate" @fullscreenchange="fullscreenchange"></video>
        <button class="btn" @click="play">播放</button>
		<button class="btn" @click="changeSrc">更换播放地址</button>
		<button class="btn" @click="changeSrc1">更换播放地址</button>
        <button class="btn" @click="pause">暂停</button>
        <button class="btn" @click="seek">跳转到指定位置20    </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>
		<button class="btn" @click="oncontrols">展示/隐藏进度条</button>
    </div>
</template>

<script>
    export default {
        data: {
            src1: "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",
			src:'http://1500003410.vod2.myqcloud.com/6c992710vodcq1500003410/5ad98f0f3701925923824863738/9F9koAkuBOsA.mp4?t=618375b5&exper=null&us=6knjy5b8&sign=c75e767b319d0d17d3c1b2b4bb37eede',
            fil: true,
            list: [{
                text: '要显示的文本',
                color: '#FF0000',
                time: 9
            }],
			controls:true
        },
        onReady() {
            this.context = uni.createVideoContext("video1", this);
        },
        methods: {
            onstart(e) {
                console.log("onstart:" + JSON.stringify(e));
            },
            onpause(e) {
                console.log("onpause:" + JSON.stringify(e));
            },
            onfinish(e) {
                console.log("onfinish:" + JSON.stringify(e));
            },
			oncontrols(){
				this.controls = !this.controls
			},
            onfail(e) {
                console.log("onfail:" + JSON.stringify(e));
            },
            fullscreenchange(e) {
                console.log("fullscreenchange:" + JSON.stringify(e));
            },
            waiting(e) {
                console.log("waiting:" + JSON.stringify(e));
            },
            timeupdate(event) {
				let a = event.detail.currentTime;
				// console.log('视频时间',a)
				let number = a.toString().split('.');
				// console.log('视频时间 number', number)
				let preventNumber = number[0];
                console.log("timeupdate:" + preventNumber);
				if(preventNumber === '22'){
					this.context.pause();
					this.context.exitFullScreen();
					this.controls = false
					// this.context.seek(36);
				}
            },

            play() {
                this.context.play();
				 this.context.seek(100);
            },
            pause() {
                this.context.pause();
            },
            seek() {
                this.context.seek(50);
            },
            stop() {
                this.context.stop();
            },
			changeSrc(){
				console.log('更换')
				this.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'
			},
			changeSrc1(){
				console.log('更换')
				this.src = 'http://1500003410.vod2.myqcloud.com/6c992710vodcq1500003410/5ad98f0f3701925923824863738/9F9koAkuBOsA.mp4?t=618375b5&exper=null&us=6knjy5b8&sign=c75e767b319d0d17d3c1b2b4bb37eede'
			},
            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>

相关问题