Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xiaoxiaoleTuia
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王剑峰
xiaoxiaoleTuia
Commits
3d657571
Commit
3d657571
authored
Jan 13, 2020
by
wjf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
l
parent
311df345
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
139 additions
and
50 deletions
+139
-50
Video.ts
egret/src/myVideo/Video.ts
+139
-50
No files found.
egret/src/myVideo/Video.ts
View file @
3d657571
...
...
@@ -193,7 +193,7 @@ class Video extends eui.Component/*egret.DisplayObjectContainer*/ {
s
.
media
.
style
.
zIndex
=
"999"
;
//宽度
s
.
media
.
style
.
width
=
"100%"
;
s
.
media
.
style
.
height
=
"450px"
;
//
s.media.style.height = "450px";
s
.
media
.
style
.
top
=
"50%"
;
s
.
media
.
style
.
transform
=
"translateY(-50%)"
;
...
...
@@ -212,7 +212,8 @@ class Video extends eui.Component/*egret.DisplayObjectContainer*/ {
if
(
!
s
.
_isAdded
)
{
s
.
_isAdded
=
true
;
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
{
if
(
s
.
media
&&
s
.
visible
)
{
s
.
media
.
style
.
display
=
"block"
;
...
...
@@ -223,11 +224,11 @@ class Video extends eui.Component/*egret.DisplayObjectContainer*/ {
s
.
play
()
},
s
)
s
.
addEventListener
(
egret
.
Event
.
REMOVED_FROM_STAGE
,
()
=>
{
console
.
log
(
1111
)
s
.
media
.
pause
();
if
(
s
.
media
)
{
s
.
media
.
style
.
display
=
"none"
;
}
if
(
s
.
element1
)
s
.
element1
.
style
.
display
=
"none"
;
if
(
s
.
appUi
)
s
.
appUi
.
style
.
display
=
"none"
;
},
s
)
...
...
@@ -263,6 +264,8 @@ class Video extends eui.Component/*egret.DisplayObjectContainer*/ {
this
.
returnCallback
=
null
;
this
.
completeCallback
=
null
;
//显示视频页
this
.
element1
.
style
.
display
=
"block"
;
//隐藏
this
.
appUi
.
style
.
display
=
"none"
;
...
...
@@ -282,8 +285,10 @@ class Video extends eui.Component/*egret.DisplayObjectContainer*/ {
// this.media.style.top = (ch - h / (w / cw)) / 2 + "px";
this
.
play
();
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
()
{
//ui放置,背景图按钮文案等
//黑色背景
...
...
@@ -294,53 +299,114 @@ class Video extends eui.Component/*egret.DisplayObjectContainer*/ {
bg
.
touchEnabled
=
true
;
this
.
addChild
(
bg
);
//关闭按钮,作用关闭自己,且回调
var
closeBtn
=
new
CusButton
(
"videoCloseBtn_png"
);
closeBtn
.
x
=
680
;
closeBtn
.
y
=
100
;
this
.
addChild
(
closeBtn
);
closeBtn
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
()
=>
{
if
(
this
.
parent
)
this
.
parent
.
removeChild
(
this
);
//关闭上报,
if
(
!
this
.
process100
)
{
//中途关闭
this
.
playReport
.
playclosemid
.
forEach
(
e
=>
{
reportGet
(
e
);
});
this
.
returnCallback
&&
this
.
returnCallback
(
false
);
}
//观看完成回调
else
{
this
.
returnCallback
&&
this
.
returnCallback
(
true
);
}
},
this
)
//
var closeBtn = new CusButton("videoCloseBtn_png");
//
closeBtn.x = 680;
//
closeBtn.y = 100;
//
this.addChild(closeBtn);
//
closeBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
//
if (this.parent) this.parent.removeChild(this);
//
//关闭上报,
//
if (!this.process100) {
//
//中途关闭
//
this.playReport.playclosemid.forEach(e => {
//
reportGet(e);
//
});
//
this.returnCallback && this.returnCallback(false);
//
}
//
//观看完成回调
//
else {
//
this.returnCallback && this.returnCallback(true);
//
}
//
}, 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
)
=>
{
// 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
Image
()
volumeBtn
.
src
=
"https://yun.duiba.com.cn/db_games/activity/xiaoxiaoleTuia/cssImage/voice.png"
;
volumeBtn
.
style
.
position
=
"absolute"
;
volumeBtn
.
style
.
right
=
"10px"
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
)
{
this
.
volume
=
0
;
this
.
volumeBtn
.
src
=
"https://yun.duiba.com.cn/db_games/activity/xiaoxiaoleTuia/cssImage/muted.png"
}
else
{
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"
);
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
)
//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
=
new
Image
();
this
.
appUi
.
src
=
this
.
videoRaw
.
rewardvideo
.
endcardimage
;
this
.
appUi
.
style
.
position
=
"absolute"
;
...
...
@@ -406,7 +472,7 @@ class Video extends eui.Component/*egret.DisplayObjectContainer*/ {
// this.playResolve();
//放置图片
this
.
appUi
.
style
.
display
=
"block"
;
this
.
media
.
style
.
display
=
"none"
;
//
this.media.style.display = "none";
},
this
);
// this.player.on('$videoClose', () => {
// this.hide();
...
...
@@ -674,10 +740,33 @@ class CusButton extends eui.Component {
}
//播放时的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
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
:
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment