Commit bb6a3fd4 authored by 李维's avatar 李维

添加视频背景

parent fccce5a8
This diff is collapsed.
......@@ -512,7 +512,7 @@ cc.Class({
console.log(" in addServerListener");
const c = window.courseware;
// this.loadEnd();
this.loadEnd();
if (!c) {
return;
}
......@@ -782,10 +782,11 @@ cc.Class({
},
// 设置视频背景
initVideoBg(width, height) {
const maskNode = cc.find('Canvas/video_bg').getComponent(cc.Mask);
maskNode.width = width;
maskNode.height = height;
initVideoBg(width, height, scale) {
console.log("视频尺寸", width, height,scale);
const bgNode = cc.find('Canvas/video_bg')
bgNode.width = width*scale;
bgNode.height = height*scale;
},
getVideoUrl(callback) {
......@@ -1054,14 +1055,16 @@ cc.Class({
console.log(" in initVideoRemote url: ", url);
const videoConfigSize = this.data.videoType.solit('_');
const videoConfigSize = this.data.videoType.split('_');
let videoSizeW = 1920;
let videoSizeH = 1080;
if(videoConfigSize.length ==2 && !isNaN(Number(videoConfigSize[0])) && !isNaN(Number(videoConfigSize[1]))) {
videoSizeW = Number(videoConfigSize[0]);
videoSizeH = Number(videoConfigSize[1]);
}
this.initVideoBg(videoSizeW, videoSizeH);
const scale = this.canvas.height / videoSizeH;
this.initVideoBg(videoSizeW, videoSizeH, scale);
const videoRemoteNode = new cc.Node();
videoRemoteNode.width = videoSizeW;
......@@ -1069,7 +1072,7 @@ cc.Class({
videoRemoteNode.parent = this.canvas;
// videoRemoteNode.y = -this.canvas.height * 1.5;
videoRemoteNode.scale = this.canvas.height / videoSizeH;
videoRemoteNode.scale = scale;
const video = videoRemoteNode.addComponent(cc.VideoPlayer);
video.resourceType = cc.VideoPlayer.ResourceType.REMOTE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment