Commit fccce5a8 authored by 李维's avatar 李维

添加视频背景

parent 23ac0969
This diff is collapsed.
...@@ -781,6 +781,13 @@ cc.Class({ ...@@ -781,6 +781,13 @@ cc.Class({
// this.checkStart(); // this.checkStart();
}, },
// 设置视频背景
initVideoBg(width, height) {
const maskNode = cc.find('Canvas/video_bg').getComponent(cc.Mask);
maskNode.width = width;
maskNode.height = height;
},
getVideoUrl(callback) { getVideoUrl(callback) {
const url1 = this.data.video_url; const url1 = this.data.video_url;
const url2 = url1.replace(/.mp4$/g, "_m.mp4"); const url2 = url1.replace(/.mp4$/g, "_m.mp4");
...@@ -1047,8 +1054,14 @@ cc.Class({ ...@@ -1047,8 +1054,14 @@ cc.Class({
console.log(" in initVideoRemote url: ", url); console.log(" in initVideoRemote url: ", url);
const videoSizeW = 1920; const videoConfigSize = this.data.videoType.solit('_');
const videoSizeH = 1080; 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 videoRemoteNode = new cc.Node(); const videoRemoteNode = new cc.Node();
videoRemoteNode.width = videoSizeW; videoRemoteNode.width = videoSizeW;
......
{
"ver": "2.3.5",
"uuid": "881bc070-a78c-4362-9165-750f7ebd04a7",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 2000,
"height": 2000,
"platformSettings": {},
"subMetas": {
"bg_video": {
"ver": "1.0.4",
"uuid": "5509c4ec-1745-4fdd-9a1d-af63bae692a8",
"rawTextureUuid": "881bc070-a78c-4362-9165-750f7ebd04a7",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 2000,
"height": 2000,
"rawWidth": 2000,
"rawHeight": 2000,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
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