Commit 2d7921af authored by 李维's avatar 李维

修复实体机器播放被遮挡的问题

parent 71939b6a
...@@ -52,7 +52,7 @@ export default class VideoPlayerComponent extends cc.Component { ...@@ -52,7 +52,7 @@ export default class VideoPlayerComponent extends cc.Component {
initSize() { initSize() {
let screen_size = cc.view.getFrameSize().width / cc.view.getFrameSize().height; let screen_size = cc.view.getFrameSize().width / cc.view.getFrameSize().height;
let design_size = cc.Canvas.instance.designResolution.width / cc.Canvas.instance.designResolution.height; let design_size = cc.Canvas.instance.designResolution.width / cc.Canvas.instance.designResolution.height;
console.log("原本尺寸",screen_size,"现在尺寸",design_size)
let f = screen_size >= design_size; let f = screen_size >= design_size;
cc.Canvas.instance.fitHeight = f; cc.Canvas.instance.fitHeight = f;
cc.Canvas.instance.fitWidth = !f; cc.Canvas.instance.fitWidth = !f;
...@@ -71,9 +71,6 @@ export default class VideoPlayerComponent extends cc.Component { ...@@ -71,9 +71,6 @@ export default class VideoPlayerComponent extends cc.Component {
this._mapScaleMin = Math.min(sx, sy) * this._cocosScale; this._mapScaleMin = Math.min(sx, sy) * this._cocosScale;
this._mapScaleMax = Math.max(sx, sy) * this._cocosScale; this._mapScaleMax = Math.max(sx, sy) * this._cocosScale;
console.log("原本宽度",cc.director["_scene"].width,"现在宽度",frameSize.width)
console.log("原本高度",cc.director["_scene"].height,"现在高度",frameSize.height)
cc.director["_scene"].width = frameSize.width; cc.director["_scene"].width = frameSize.width;
cc.director["_scene"].height = frameSize.height; cc.director["_scene"].height = frameSize.height;
} }
...@@ -137,8 +134,8 @@ export default class VideoPlayerComponent extends cc.Component { ...@@ -137,8 +134,8 @@ export default class VideoPlayerComponent extends cc.Component {
cc.debug.setDisplayStats(false); cc.debug.setDisplayStats(false);
this.initSize(); this.initSize();
cc.find('Canvas/bg').scale = this._mapScaleMax; // cc.find('Canvas/bg').scale = this._mapScaleMax;
cc.find('Canvas/video_node/bg').scale = this._mapScaleMax; // cc.find('Canvas/video_node/bg').scale = this._mapScaleMax;
// cc.find('Canvas/bgwhite').zIndex=-2 // cc.find('Canvas/bgwhite').zIndex=-2
// cc.find('Canvas/bg').zIndex=-1 // cc.find('Canvas/bg').zIndex=-1
...@@ -208,20 +205,19 @@ export default class VideoPlayerComponent extends cc.Component { ...@@ -208,20 +205,19 @@ export default class VideoPlayerComponent extends cc.Component {
} }
}); });
this.videoPlayer.node.on('playing', () => { this.videoPlayer.node.on('playing', () => {
console.log('playing');
this.durationLabel.string = this.formatTime(this.videoPlayer.getDuration()); this.durationLabel.string = this.formatTime(this.videoPlayer.getDuration());
this.playButton.node.active = false; this.playButton.node.active = false;
this.restartButton.node.active = false; this.restartButton.node.active = false;
this.pauseButton.node.active = true; this.pauseButton.node.active = true;
}); });
this.videoPlayer.node.on('paused', () => { this.videoPlayer.node.on('paused', () => {
console.log('paused');
}); });
this.videoPlayer.node.on('stopped', () => { this.videoPlayer.node.on('stopped', () => {
console.log('stopped');
}); });
this.videoPlayer.node.on('completed', async () => { this.videoPlayer.node.on('completed', async () => {
console.log('completed');
this._isPlayComplated = true; this._isPlayComplated = true;
this.playButton.node.active = false; this.playButton.node.active = false;
this.pauseButton.node.active = false; this.pauseButton.node.active = false;
...@@ -235,7 +231,6 @@ export default class VideoPlayerComponent extends cc.Component { ...@@ -235,7 +231,6 @@ export default class VideoPlayerComponent extends cc.Component {
} }
}); });
cc.view.setResizeCallback(() => { cc.view.setResizeCallback(() => {
console.log('Resize');
this.initdDrag(); this.initdDrag();
}); });
...@@ -250,6 +245,7 @@ export default class VideoPlayerComponent extends cc.Component { ...@@ -250,6 +245,7 @@ export default class VideoPlayerComponent extends cc.Component {
if (this.videoItemList) if (this.videoItemList)
cc.find("Canvas/btn_next").active=this.videoPlayIndex!=this.videoItemList.length-1 cc.find("Canvas/btn_next").active=this.videoPlayIndex!=this.videoItemList.length-1
} }
onClickNext(){ onClickNext(){
const nextItem = this.videoItemList[this.videoPlayIndex + 1]; const nextItem = this.videoItemList[this.videoPlayIndex + 1];
if (nextItem) { if (nextItem) {
...@@ -259,6 +255,7 @@ export default class VideoPlayerComponent extends cc.Component { ...@@ -259,6 +255,7 @@ export default class VideoPlayerComponent extends cc.Component {
} }
this.refreshLastNextBtns() this.refreshLastNextBtns()
} }
onClickLast(){ onClickLast(){
const nextItem = this.videoItemList[this.videoPlayIndex - 1]; const nextItem = this.videoItemList[this.videoPlayIndex - 1];
if (nextItem) { if (nextItem) {
...@@ -272,7 +269,6 @@ export default class VideoPlayerComponent extends cc.Component { ...@@ -272,7 +269,6 @@ export default class VideoPlayerComponent extends cc.Component {
initListener() { initListener() {
if (window['air']) { if (window['air']) {
window["air"].dialogStatus = (statusCode: number) => { window["air"].dialogStatus = (statusCode: number) => {
console.log("缓冲", statusCode);
if (statusCode == 701) { if (statusCode == 701) {
this.loadingSprite.active = true; this.loadingSprite.active = true;
} else if (statusCode == 702) { } else if (statusCode == 702) {
...@@ -291,7 +287,6 @@ export default class VideoPlayerComponent extends cc.Component { ...@@ -291,7 +287,6 @@ export default class VideoPlayerComponent extends cc.Component {
if (!this._isReadyToPlay) { if (!this._isReadyToPlay) {
return; return;
} }
console.log("TOUCH_START");
}); });
this.barTag.off(cc.Node.EventType.TOUCH_MOVE); this.barTag.off(cc.Node.EventType.TOUCH_MOVE);
this.barTag.on(cc.Node.EventType.TOUCH_MOVE, (e) => { this.barTag.on(cc.Node.EventType.TOUCH_MOVE, (e) => {
...@@ -313,7 +308,6 @@ export default class VideoPlayerComponent extends cc.Component { ...@@ -313,7 +308,6 @@ export default class VideoPlayerComponent extends cc.Component {
if (!this._isReadyToPlay) { if (!this._isReadyToPlay) {
return; return;
} }
console.log("TOUCH_ENDED");
this.updateBarByPos(this.barTag.x); this.updateBarByPos(this.barTag.x);
}); });
this.barTag.off(cc.Node.EventType.MOUSE_UP); this.barTag.off(cc.Node.EventType.MOUSE_UP);
...@@ -321,7 +315,6 @@ export default class VideoPlayerComponent extends cc.Component { ...@@ -321,7 +315,6 @@ export default class VideoPlayerComponent extends cc.Component {
if (!this._isReadyToPlay) { if (!this._isReadyToPlay) {
return; return;
} }
console.log("MOUSE_UP");
this.updateBarByPos(this.barTag.x); this.updateBarByPos(this.barTag.x);
}); });
} }
...@@ -441,9 +434,8 @@ export default class VideoPlayerComponent extends cc.Component { ...@@ -441,9 +434,8 @@ export default class VideoPlayerComponent extends cc.Component {
} }
cc.find(`Canvas/videolist`).active = this.data.dataArr.length>1; cc.find(`Canvas/videolist`).active = this.data.dataArr.length>1;
if (this.data.dataArr.length<=1){ if (this.data.dataArr.length<=1){
console.log("qsj???") cc.find(`Canvas/video_node/videoBg`).scale=1.2
cc.find(`Canvas/bg/videoBg`).scale=1.2 cc.find(`Canvas/video_node/videoBg`).y=-136.058
cc.find(`Canvas/bg/videoBg`).y=-136.058
// cc.find(`Canvas/video_node`).scale=1.2 // cc.find(`Canvas/video_node`).scale=1.2
cc.find(`Canvas/video_node`).width*=1.2 cc.find(`Canvas/video_node`).width*=1.2
cc.find(`Canvas/video_node`).height*=1.2 cc.find(`Canvas/video_node`).height*=1.2
...@@ -531,18 +523,15 @@ export default class VideoPlayerComponent extends cc.Component { ...@@ -531,18 +523,15 @@ export default class VideoPlayerComponent extends cc.Component {
} }
play() { play() {
console.log("PL")
if (!this._isReadyToPlay) { if (!this._isReadyToPlay) {
return; return;
} }
const { width, height } = cc.find(`Canvas/bg`);
cc.find(`Canvas/text_tips`).active = false; cc.find(`Canvas/text_tips`).active = false;
// cc.find(`Canvas/bg`).active = false; cc.find(`Canvas/bg`).active = false;
cc.find(`Canvas/bgwhite`).active = false; cc.find(`Canvas/bgwhite`).active = false;
const videoContainer = cc.find('Canvas/video_node'); const videoContainer = cc.find('Canvas/video_node');
cc.find('bg', videoContainer).width = width;
cc.find('bg', videoContainer).height = height;
this.videoPlayer.node.x = videoContainer.x; this.videoPlayer.node.x = videoContainer.x;
this.videoPlayer.node.y = videoContainer.y; this.videoPlayer.node.y = videoContainer.y;
this.videoPlayer.play(); this.videoPlayer.play();
...@@ -682,8 +671,6 @@ export default class VideoPlayerComponent extends cc.Component { ...@@ -682,8 +671,6 @@ export default class VideoPlayerComponent extends cc.Component {
} }
update(dt: number) { update(dt: number) {
console.log("==VIDEO==",this.node.active);
if (!this._isReadyToPlay) { if (!this._isReadyToPlay) {
return; return;
} }
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
"premultiplyAlpha": false, "premultiplyAlpha": true,
"genMipmaps": false, "genMipmaps": false,
"packable": true, "packable": true,
"width": 1920, "width": 1920,
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
"premultiplyAlpha": false, "premultiplyAlpha": true,
"genMipmaps": false, "genMipmaps": false,
"packable": true, "packable": true,
"width": 223, "width": 223,
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
"premultiplyAlpha": false, "premultiplyAlpha": true,
"genMipmaps": false, "genMipmaps": false,
"packable": true, "packable": true,
"width": 200, "width": 200,
......
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