Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dg_video
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
template admin
dg_video
Commits
e81a620b
Commit
e81a620b
authored
Oct 27, 2022
by
liujiangnan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 各种控制
parent
8acca360
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
364 additions
and
258 deletions
+364
-258
dg_video.fire
assets/dg_video/Scene/dg_video.fire
+302
-236
dg_video.js
assets/dg_video/Scene/dg_video.js
+62
-22
No files found.
assets/dg_video/Scene/dg_video.fire
View file @
e81a620b
This diff is collapsed.
Click to expand it.
assets/dg_video/Scene/dg_video.js
View file @
e81a620b
...
@@ -160,10 +160,12 @@ cc.Class({
...
@@ -160,10 +160,12 @@ cc.Class({
});
});
this
.
videoPlayer
.
node
.
on
(
'
meta-loaded
'
,
()
=>
{
this
.
videoPlayer
.
node
.
on
(
'
meta-loaded
'
,
()
=>
{
console
.
log
(
'
meta-loaded
'
);
console
.
log
(
'
meta-loaded
'
);
cc
.
find
(
`Canvas/bg_video_shadow`
).
active
=
false
;
this
.
_isReadyToPlay
=
true
;
this
.
_isReadyToPlay
=
true
;
this
.
durationLabel
.
string
=
this
.
formatTime
(
this
.
videoPlayer
.
getDuration
());
this
.
durationLabel
.
string
=
this
.
formatTime
(
this
.
videoPlayer
.
getDuration
());
this
.
videoPlayer
.
currentTime
=
0
;
// this.videoPlayer.resume();
// this.videoPlayer.resume();
this
.
videoPlayer
.
play
();
this
.
play
();
});
});
this
.
videoPlayer
.
node
.
on
(
'
clicked
'
,
()
=>
{
this
.
videoPlayer
.
node
.
on
(
'
clicked
'
,
()
=>
{
console
.
log
(
'
clicked
'
);
console
.
log
(
'
clicked
'
);
...
@@ -306,12 +308,22 @@ cc.Class({
...
@@ -306,12 +308,22 @@ cc.Class({
},
},
// 选择视频播放
// 选择视频播放
async
clickVideoItem
(
evt
)
{
async
clickVideoItem
(
evt
)
{
this
.
_isReadyToPlay
=
false
;
const
item
=
evt
.
currentTarget
;
const
item
=
evt
.
currentTarget
;
if
(
!
item
.
video_url
)
{
if
(
!
item
.
video_url
)
{
this
.
showTips
(
"
视频不存在
"
);
this
.
showTips
(
"
视频不存在
"
);
return
;
}
if
(
item
.
video_url
==
this
.
videoPlayer
.
remoteURL
)
{
this
.
showTips
(
"
该视频正在播放
"
);
return
;
return
;
}
}
this
.
_isReadyToPlay
=
false
;
cc
.
find
(
`Canvas/bg`
).
active
=
true
;
cc
.
find
(
`Canvas/bgwhite`
).
active
=
true
;
cc
.
find
(
`Canvas/bg_video_shadow`
).
active
=
true
;
this
.
videoPlayer
.
node
.
x
=
-
5000
;
this
.
videoPlayer
.
node
.
y
=
-
5000
;
cc
.
find
(
`Canvas/videolist/view/content`
).
children
.
forEach
(
row
=>
{
cc
.
find
(
`Canvas/videolist/view/content`
).
children
.
forEach
(
row
=>
{
cc
.
find
(
`item_active`
,
row
).
active
=
false
;
cc
.
find
(
`item_active`
,
row
).
active
=
false
;
});
});
...
@@ -405,16 +417,16 @@ cc.Class({
...
@@ -405,16 +417,16 @@ cc.Class({
return
;
return
;
}
}
const
{
width
,
height
}
=
cc
.
find
(
`Canvas/bg`
);
const
{
width
,
height
}
=
cc
.
find
(
`Canvas/bg`
);
cc
.
find
(
`Canvas/Controls/ProgressBar/text_tips
_left
`
).
active
=
false
;
cc
.
find
(
`Canvas/Controls/ProgressBar/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
;
cc
.
find
(
`Canvas/bg_
empty
`
).
active
=
false
;
cc
.
find
(
`Canvas/bg_
video_shadow
`
).
active
=
false
;
c
c
.
find
(
'
Canvas/video_node/bg
'
).
width
=
width
;
c
onst
videoContainer
=
cc
.
find
(
'
Canvas/video_node
'
)
;
cc
.
find
(
'
Canvas/video_node/bg
'
).
height
=
height
;
cc
.
find
(
'
bg
'
,
videoContainer
).
width
=
width
;
this
.
videoPlayer
.
node
.
x
=
0
;
cc
.
find
(
'
bg
'
,
videoContainer
).
height
=
height
;
this
.
videoPlayer
.
node
.
y
=
0
;
this
.
videoPlayer
.
node
.
x
=
videoContainer
.
x
;
// this.videoPlayer.node.active = true
;
this
.
videoPlayer
.
node
.
y
=
videoContainer
.
y
;
this
.
videoPlayer
.
play
();
this
.
videoPlayer
.
play
();
},
},
pause
(){
pause
(){
...
@@ -438,23 +450,41 @@ cc.Class({
...
@@ -438,23 +450,41 @@ cc.Class({
time1
:
null
,
time1
:
null
,
isVideoFull
:
false
,
isVideoFull
:
false
,
tempPos
:
null
,
fullScreen
()
{
fullScreen
()
{
if
(
this
.
isVideoFull
)
{
if
(
this
.
isVideoFull
)
{
return
;
return
;
}
}
if
(
!
this
.
_isReadyToPlay
)
{
return
;
}
this
.
tempPos
=
{};
console
.
log
(
"
====进入全屏===
"
);
console
.
log
(
"
====进入全屏===
"
);
this
.
isVideoFull
=
true
;
this
.
isVideoFull
=
true
;
this
.
videoPlayer
.
stayOnBottom
=
true
;
this
.
videoPlayer
.
stayOnBottom
=
true
;
cc
.
find
(
`Canvas/Controls/fullscreen`
).
active
=
!
this
.
isVideoFull
;
cc
.
find
(
`Canvas/Controls/fullscreen`
).
active
=
!
this
.
isVideoFull
;
cc
.
find
(
`Canvas/Controls/exitfull`
).
active
=
this
.
isVideoFull
;
cc
.
find
(
`Canvas/Controls/exitfull`
).
active
=
this
.
isVideoFull
;
cc
.
find
(
`Canvas/video_node`
).
width
=
this
.
node
.
width
;
const
videoContainer
=
cc
.
find
(
'
Canvas/video_node
'
);
cc
.
find
(
`Canvas/video_node`
).
height
=
this
.
node
.
height
;
this
.
tempPos
.
videoPos
=
{
x
:
videoContainer
.
x
,
y
:
videoContainer
.
y
,
width
:
videoContainer
.
width
,
height
:
videoContainer
.
height
};
cc
.
find
(
`Canvas/bg_empty`
).
width
=
this
.
node
.
width
;
videoContainer
.
width
=
this
.
node
.
width
;
cc
.
find
(
`Canvas/bg_empty`
).
height
=
this
.
node
.
height
;
videoContainer
.
height
=
this
.
node
.
height
;
videoContainer
.
x
=
0
;
videoContainer
.
y
=
0
;
cc
.
find
(
`Canvas/videolist`
).
active
=
false
;
const
controls
=
cc
.
find
(
`Canvas/Controls`
);
this
.
tempPos
.
controlPos
=
{
x
:
controls
.
x
,
y
:
controls
.
y
};
cc
.
find
(
`bg_video_bottom`
,
controls
).
active
=
false
;
controls
.
x
=
0
;
controls
.
y
=
0
-
this
.
node
.
height
/
2
+
130
;
this
.
videoPlayer
.
node
.
height
=
this
.
node
.
height
;
this
.
videoPlayer
.
node
.
height
=
this
.
node
.
height
;
this
.
videoPlayer
.
node
.
width
=
this
.
node
.
width
;
this
.
videoPlayer
.
node
.
width
=
this
.
node
.
width
;
this
.
videoPlayer
.
node
.
x
=
0
;
this
.
videoPlayer
.
node
.
y
=
0
;
setTimeout
(()
=>
{
setTimeout
(()
=>
{
// IOS下视频的全屏适配比例有问题,所以做一个计算
// IOS下视频的全屏适配比例有问题,所以做一个计算
this
.
videoPlayer
.
node
.
width
=
Math
.
min
(
this
.
node
.
width
,
this
.
node
.
height
*
16
/
9
);
this
.
videoPlayer
.
node
.
width
=
Math
.
min
(
this
.
node
.
width
,
this
.
node
.
height
*
16
/
9
);
...
@@ -470,19 +500,29 @@ cc.Class({
...
@@ -470,19 +500,29 @@ cc.Class({
if
(
!
this
.
isVideoFull
)
{
if
(
!
this
.
isVideoFull
)
{
return
;
return
;
}
}
console
.
log
(
"
====退出全屏===
"
);
console
.
log
(
"
====退出全屏===
"
,
this
.
tempPos
);
this
.
isVideoFull
=
false
;
this
.
isVideoFull
=
false
;
cc
.
find
(
`Canvas/Controls/fullscreen`
).
active
=
!
this
.
isVideoFull
;
cc
.
find
(
`Canvas/Controls/fullscreen`
).
active
=
!
this
.
isVideoFull
;
cc
.
find
(
`Canvas/Controls/exitfull`
).
active
=
this
.
isVideoFull
;
cc
.
find
(
`Canvas/Controls/exitfull`
).
active
=
this
.
isVideoFull
;
cc
.
find
(
`Canvas/video_node`
).
width
=
1377
;
const
videoContainer
=
cc
.
find
(
'
Canvas/video_node
'
);
cc
.
find
(
`Canvas/video_node`
).
height
=
775
;
videoContainer
.
width
=
this
.
tempPos
.
videoPos
.
width
;
cc
.
find
(
`Canvas/bg_empty`
).
width
=
1377
;
videoContainer
.
height
=
this
.
tempPos
.
videoPos
.
height
;
cc
.
find
(
`Canvas/bg_empty`
).
height
=
775
;
videoContainer
.
x
=
this
.
tempPos
.
videoPos
.
x
;
videoContainer
.
y
=
this
.
tempPos
.
videoPos
.
y
;
this
.
videoPlayer
.
node
.
width
=
1377
;
this
.
videoPlayer
.
node
.
width
=
this
.
tempPos
.
videoPos
.
width
;
this
.
videoPlayer
.
node
.
height
=
775
;
this
.
videoPlayer
.
node
.
height
=
this
.
tempPos
.
videoPos
.
height
;
this
.
videoPlayer
.
node
.
x
=
videoContainer
.
x
;
this
.
videoPlayer
.
node
.
y
=
videoContainer
.
y
;
cc
.
find
(
`Canvas/videolist`
).
active
=
true
;
const
controls
=
cc
.
find
(
`Canvas/Controls`
);
cc
.
find
(
`bg_video_bottom`
,
controls
).
active
=
true
;
controls
.
x
=
this
.
tempPos
.
controlPos
.
x
;
controls
.
y
=
this
.
tempPos
.
controlPos
.
y
;
if
(
this
.
time1
)
{
if
(
this
.
time1
)
{
clearTimeout
(
this
.
time1
);
clearTimeout
(
this
.
time1
);
}
}
...
...
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