videoPlayer组件一直处于在最上层的问题

1.开启canvas透明权限,并且设置透明度为0

// 在main.js 加入以下代码:
cc.macro.ENABLE_TRANSPARENT_CANVAS = true;  //加在 cc.game.run(); 前面
cc.director.setClearColor(new cc.Color(0,0,0, 0));  //加在cc.game.run(function); 回调里面

2. 设置canvas和video 标签层级


 initVideoZIndex: function () {
        //cc.director.setClearColor(new cc.Color(0, 0, 0, 0))

        let video0 = document.getElementsByClassName('cocosVideo')[0];
        video0.style.zIndex = 5;
        video0.setAttribute("x5-video-player-type", "h5");
        video0.setAttribute("webkit-playsinline", true);
        video0.setAttribute("x-webkit-airplay", true);
        video0.setAttribute("x5-video-orientation", "h5");
        // video0.setAttribute("x5-video-player-fullscreen",true);
        video0.setAttribute("preload", "auto");
        let gCanvas = document.getElementsByClassName('gameCanvas')[0];
        gCanvas.style.position = 'relative';
        gCanvas.style.zIndex = 10;
    },
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值