Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
ngt_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
ngt_video
Commits
acccaca8
Commit
acccaca8
authored
Oct 03, 2022
by
liujiangnan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat
parent
fb2dcfa5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
7 deletions
+9
-7
ngt_video.js
assets/ngt_video/Scene/ngt_video.js
+7
-5
bg.png.meta
assets/ngt_video/Texture/video/bg.png.meta
+2
-2
No files found.
assets/ngt_video/Scene/ngt_video.js
View file @
acccaca8
...
@@ -143,8 +143,8 @@ cc.Class({
...
@@ -143,8 +143,8 @@ cc.Class({
},
},
// use this for initialization
// use this for initialization
_isPlayComplated
:
null
,
onLoad
()
{
onLoad
()
{
cc
.
debug
.
setDisplayStats
(
false
);
cc
.
debug
.
setDisplayStats
(
false
);
this
.
initSize
();
this
.
initSize
();
...
@@ -197,6 +197,7 @@ cc.Class({
...
@@ -197,6 +197,7 @@ cc.Class({
this
.
videoPlayer
.
node
.
on
(
'
completed
'
,
async
()
=>
{
this
.
videoPlayer
.
node
.
on
(
'
completed
'
,
async
()
=>
{
console
.
log
(
'
completed
'
);
console
.
log
(
'
completed
'
);
// this.videoPlayer.currentTime = 0;
// this.videoPlayer.currentTime = 0;
this
.
_isPlayComplated
=
true
;
this
.
playButton
.
node
.
active
=
false
;
this
.
playButton
.
node
.
active
=
false
;
this
.
pauseButton
.
node
.
active
=
false
;
this
.
pauseButton
.
node
.
active
=
false
;
this
.
restartButton
.
node
.
active
=
true
;
this
.
restartButton
.
node
.
active
=
true
;
...
@@ -226,15 +227,12 @@ cc.Class({
...
@@ -226,15 +227,12 @@ cc.Class({
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
)
=>
{
var
delta
=
e
.
getDelta
();
var
delta
=
e
.
getDelta
();
let
newX
=
this
.
barTag
.
x
+
delta
.
x
;
let
newX
=
this
.
barTag
.
x
+
delta
.
x
*
2
;
newX
=
Math
.
min
(
maxX
,
Math
.
max
(
newX
,
minX
));
newX
=
Math
.
min
(
maxX
,
Math
.
max
(
newX
,
minX
));
this
.
barTag
.
x
=
newX
;
this
.
barTag
.
x
=
newX
;
const
percent
=
newX
/
maxX
;
const
percent
=
newX
/
maxX
;
// console.log(newX, percent);
const
dur
=
this
.
videoPlayer
.
getDuration
();
const
dur
=
this
.
videoPlayer
.
getDuration
();
// this.videoPlayer.currentTime = percent * dur
// this.updateBarByPos(this.barTag.x);
this
.
currentTimeLabel
.
string
=
this
.
formatTime
(
percent
*
dur
);
this
.
currentTimeLabel
.
string
=
this
.
formatTime
(
percent
*
dur
);
this
.
triggerInteractive
()
this
.
triggerInteractive
()
});
});
...
@@ -378,6 +376,9 @@ cc.Class({
...
@@ -378,6 +376,9 @@ cc.Class({
this
.
videoPlayer
.
currentTime
=
percent
*
dur
this
.
videoPlayer
.
currentTime
=
percent
*
dur
},
},
updateBarByTime
(
ct
){
updateBarByTime
(
ct
){
if
(
this
.
_isPlayComplated
)
{
return
;
}
this
.
currentTimeLabel
.
string
=
this
.
formatTime
(
ct
);
this
.
currentTimeLabel
.
string
=
this
.
formatTime
(
ct
);
const
dur
=
this
.
videoPlayer
.
getDuration
();
const
dur
=
this
.
videoPlayer
.
getDuration
();
const
percent
=
ct
/
dur
;
const
percent
=
ct
/
dur
;
...
@@ -449,6 +450,7 @@ cc.Class({
...
@@ -449,6 +450,7 @@ cc.Class({
},
},
replay
(){
replay
(){
this
.
_isPlayComplated
=
false
;
this
.
videoPlayer
.
currentTime
=
0
;
this
.
videoPlayer
.
currentTime
=
0
;
this
.
videoPlayer
.
play
();
this
.
videoPlayer
.
play
();
this
.
triggerInteractive
();
this
.
triggerInteractive
();
...
...
assets/ngt_video/Texture/video/bg.png.meta
View file @
acccaca8
...
@@ -7,8 +7,8 @@
...
@@ -7,8 +7,8 @@
"premultiplyAlpha": false,
"premultiplyAlpha": false,
"genMipmaps": false,
"genMipmaps": false,
"packable": true,
"packable": true,
"width": 1
28
0,
"width": 1
92
0,
"height":
72
0,
"height":
108
0,
"platformSettings": {},
"platformSettings": {},
"subMetas": {
"subMetas": {
"bg": {
"bg": {
...
...
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