Commit 4ab7b69f authored by luofangping's avatar luofangping

fix:合并

parents 5b853ce6 146bebe8
...@@ -194,7 +194,7 @@ class Video extends eui.Component/*egret.DisplayObjectContainer*/ { ...@@ -194,7 +194,7 @@ class Video extends eui.Component/*egret.DisplayObjectContainer*/ {
s.media.style.zIndex = "999"; s.media.style.zIndex = "999";
//宽度 //宽度
s.media.style.width = "100%"; s.media.style.width = "100%";
s.media.style.height = "450px"; // s.media.style.height = "450px";
s.media.style.top = "50%"; s.media.style.top = "50%";
s.media.style.transform = "translateY(-50%)"; s.media.style.transform = "translateY(-50%)";
...@@ -213,7 +213,8 @@ class Video extends eui.Component/*egret.DisplayObjectContainer*/ { ...@@ -213,7 +213,8 @@ class Video extends eui.Component/*egret.DisplayObjectContainer*/ {
if (!s._isAdded) { if (!s._isAdded) {
s._isAdded = true; s._isAdded = true;
document.body.appendChild(s.media) document.body.appendChild(s.media)
if (s.appUi) document.body.appendChild(s.appUi) if (s.element1) document.body.appendChild(s.element1);
if (s.appUi) document.body.appendChild(s.appUi);
} else { } else {
if (s.media && s.visible) { if (s.media && s.visible) {
s.media.style.display = "block"; s.media.style.display = "block";
...@@ -224,11 +225,11 @@ class Video extends eui.Component/*egret.DisplayObjectContainer*/ { ...@@ -224,11 +225,11 @@ class Video extends eui.Component/*egret.DisplayObjectContainer*/ {
s.play() s.play()
}, s) }, s)
s.addEventListener(egret.Event.REMOVED_FROM_STAGE, () => { s.addEventListener(egret.Event.REMOVED_FROM_STAGE, () => {
console.log(1111)
s.media.pause(); s.media.pause();
if (s.media) { if (s.media) {
s.media.style.display = "none"; s.media.style.display = "none";
} }
if (s.element1) s.element1.style.display = "none";
if (s.appUi) s.appUi.style.display = "none"; if (s.appUi) s.appUi.style.display = "none";
}, s) }, s)
...@@ -264,6 +265,8 @@ class Video extends eui.Component/*egret.DisplayObjectContainer*/ { ...@@ -264,6 +265,8 @@ class Video extends eui.Component/*egret.DisplayObjectContainer*/ {
this.returnCallback = null; this.returnCallback = null;
this.completeCallback = null; this.completeCallback = null;
//显示视频页
this.element1.style.display = "block";
//隐藏 //隐藏
this.appUi.style.display = "none"; this.appUi.style.display = "none";
...@@ -283,8 +286,10 @@ class Video extends eui.Component/*egret.DisplayObjectContainer*/ { ...@@ -283,8 +286,10 @@ class Video extends eui.Component/*egret.DisplayObjectContainer*/ {
// this.media.style.top = (ch - h / (w / cw)) / 2 + "px"; // this.media.style.top = (ch - h / (w / cw)) / 2 + "px";
this.play(); this.play();
this.volume = 1; this.volume = 1;
this.volumeBtn.src = "https://yun.duiba.com.cn/db_games/activity/xiaoxiaoleTuia/cssImage/voice.png"
} }
private element1: HTMLDivElement;
private volumeBtn: HTMLImageElement
private initUi() { private initUi() {
//ui放置,背景图按钮文案等 //ui放置,背景图按钮文案等
//黑色背景 //黑色背景
...@@ -295,38 +300,95 @@ class Video extends eui.Component/*egret.DisplayObjectContainer*/ { ...@@ -295,38 +300,95 @@ class Video extends eui.Component/*egret.DisplayObjectContainer*/ {
bg.touchEnabled = true; bg.touchEnabled = true;
this.addChild(bg); this.addChild(bg);
//关闭按钮,作用关闭自己,且回调 //关闭按钮,作用关闭自己,且回调
var closeBtn = new CusButton("videoCloseBtn_png"); // var closeBtn = new CusButton("videoCloseBtn_png");
closeBtn.x = 680; // closeBtn.x = 680;
closeBtn.y = 100; // closeBtn.y = 100;
this.addChild(closeBtn); // this.addChild(closeBtn);
closeBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, () => { // closeBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
if (this.parent) this.parent.removeChild(this); // if (this.parent) this.parent.removeChild(this);
//关闭上报, // //关闭上报,
if (!this.process100) { // if (!this.process100) {
//中途关闭 // //中途关闭
this.playReport.playclosemid.forEach(e => { // this.playReport.playclosemid.forEach(e => {
reportGet(e); // reportGet(e);
}); // });
this.returnCallback && this.returnCallback(false); // this.returnCallback && this.returnCallback(false);
} // }
//观看完成回调 // //观看完成回调
else { // else {
this.returnCallback && this.returnCallback(true); // this.returnCallback && this.returnCallback(true);
} // }
}, this) // }, this)
//静音按钮
// var volumeBtn = new CusButton("volumeBtn_png");
// volumeBtn.x = 80;
// volumeBtn.y = 100;
// this.addChild(volumeBtn);
// volumeBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, (e: egret.TouchEvent) => {
// if (this.volume) {
// this.volume = 0;
// } else {
// this.volume = 1;
// }
// }, this)
//下载按钮
// var downloadBtn = new CusButton("downloadBtn_png");
// downloadBtn.x = 375;
// var stageHeight = document.body.clientHeight / document.body.clientWidth * 750;
// downloadBtn.y = stageHeight - 100;
// this.addChild(downloadBtn);
// //如果执行了,可能就跳转了,所以就一次吧
// downloadBtn.once(egret.TouchEvent.TOUCH_TAP, (e) => {
// this.reportClick({
// screenX: e.stageX * document.body.clientWidth / this.stage.stageWidth,
// screenY: e.stageY * document.body.clientHeight / this.stage.stageHeight,
// });
// }, this)
//播放时的ui
var element1: HTMLDivElement = document.createElement("div");
element1.style.margin = "auto";
element1.style.width = "100%";
element1.style.height = "100%";
element1.style.overflow = "hidden";
element1.style.position = "absolute";
//静音按钮 //静音按钮
var volumeBtn = new CusButton("volumeBtn_png"); var volumeBtn = new Image()
volumeBtn.x = 80; volumeBtn.src = "https://yun.duiba.com.cn/db_games/activity/xiaoxiaoleTuia/cssImage/voice.png";
volumeBtn.y = 100; volumeBtn.style.position = "absolute";
this.addChild(volumeBtn); volumeBtn.style.right = "10px"
volumeBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, (e: egret.TouchEvent) => { volumeBtn.style.top = "50%"
volumeBtn.style.transform = "translateY(-50%)";
volumeBtn.style.width = "10vw"
volumeBtn.style.height = "10vw";
volumeBtn.style.zIndex = "9999"
element1.appendChild(volumeBtn)
volumeBtn.addEventListener("click", (e) => {
if (this.volume) { if (this.volume) {
this.volume = 0; this.volume = 0;
this.volumeBtn.src = "https://yun.duiba.com.cn/db_games/activity/xiaoxiaoleTuia/cssImage/muted.png"
} else { } else {
this.volume = 1; this.volume = 1;
this.volumeBtn.src = "https://yun.duiba.com.cn/db_games/activity/xiaoxiaoleTuia/cssImage/voice.png"
} }
})
this.volumeBtn = volumeBtn;
//关闭按钮
var closeBtn = new Image()
closeBtn.src = "https://yun.duiba.com.cn/db_games/activity/xiaoxiaoleTuia/cssImage/videoCloseBtn.png";
closeBtn.style.position = "absolute";
closeBtn.style.top = "10vw";
closeBtn.style.right = "10px";
closeBtn.style.width = "10vw";
closeBtn.style.height = "10vw"
closeBtn.style.zIndex = "9999"
element1.appendChild(closeBtn)
closeBtn.addEventListener("click", (e) => {
this.closeEvent();
})
}, this)
//下载按钮 //下载按钮
var downloadBtn = new CusButton("downloadBtn_png"); var downloadBtn = new CusButton("downloadBtn_png");
downloadBtn.x = 375; downloadBtn.x = 375;
...@@ -342,6 +404,24 @@ class Video extends eui.Component/*egret.DisplayObjectContainer*/ { ...@@ -342,6 +404,24 @@ class Video extends eui.Component/*egret.DisplayObjectContainer*/ {
}, this) }, this)
//appUi //appUi
var downloadBtn = new Image()
downloadBtn.src = "https://yun.duiba.com.cn/db_games/activity/xiaoxiaoleTuia/cssImage/downloadBtn.png";
downloadBtn.style.position = "absolute";
downloadBtn.style.margin = "0 auto";
downloadBtn.style.bottom = "10px";
downloadBtn.style.zIndex = "9999";
downloadBtn.style.width = "50vw";
downloadBtn.style.left = "50%"
downloadBtn.style.transform = "translateX(-50%)"
element1.appendChild(downloadBtn)
downloadBtn.addEventListener("click", (e) => {
this.downloadEvent(e);
})
this.element1 = element1;
this.element1.style.display = "block";
//appUi,待修改
this.appUi = document.createElement('div'); this.appUi = document.createElement('div');
this.appUi.style.display = "none"; this.appUi.style.display = "none";
} }
...@@ -424,7 +504,7 @@ class Video extends eui.Component/*egret.DisplayObjectContainer*/ { ...@@ -424,7 +504,7 @@ class Video extends eui.Component/*egret.DisplayObjectContainer*/ {
// this.playResolve(); // this.playResolve();
//放置图片 //放置图片
this.appUi.style.display = "block"; this.appUi.style.display = "block";
this.media.style.display = "none"; // this.media.style.display = "none";
}, this); }, this);
// this.player.on('$videoClose', () => { // this.player.on('$videoClose', () => {
// this.hide(); // this.hide();
...@@ -700,3 +780,26 @@ element1.style.height = "100%"; ...@@ -700,3 +780,26 @@ element1.style.height = "100%";
element1.style.overflow = "hidden"; element1.style.overflow = "hidden";
element1.style.position = "absolute"; element1.style.position = "absolute";
//静音按钮 //静音按钮
var volumeBtn: HTMLDivElement = document.createElement("div");
volumeBtn.style.backgroundImage = "https://yun.duiba.com.cn/db_games/activity/xiaoxiaoleTuia/cssImage/volumeBtn.png";
volumeBtn.style.position = "absolute";
volumeBtn.style.right = "10px"
volumeBtn.style.top = "10px"
volumeBtn.style.transform = "translateY(-50%)";
element1.appendChild(volumeBtn)
//关闭按钮
var closeBtn: HTMLDivElement = document.createElement("div");
closeBtn.style.backgroundImage = "https://yun.duiba.com.cn/db_games/activity/xiaoxiaoleTuia/cssImage/volumeBtn.png";
closeBtn.style.position = "absolute";
closeBtn.style.top = "10px";
closeBtn.style.right = "10px";
element1.appendChild(closeBtn)
//下载按钮
var downloadBtn: HTMLDivElement = document.createElement("div");
downloadBtn.style.backgroundImage = "https://yun.duiba.com.cn/db_games/activity/xiaoxiaoleTuia/cssImage/downloadBtn.png";
downloadBtn.style.position = "absolute";
downloadBtn.style.margin = "0 auto";
downloadBtn.style.bottom = "10px";
element1.appendChild(downloadBtn)
\ 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