Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MRBR_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
MRBR_video
Commits
35ac3460
Commit
35ac3460
authored
Nov 14, 2022
by
李维
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调整进度条自动隐藏
parent
d215459d
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
341 additions
and
76 deletions
+341
-76
myVideoControlScript.js
...R_video/prefab/VideoControlBar/js/myVideoControlScript.js
+69
-10
MRBR_video.fire
assets/MRBR_video/scene/MRBR_video.fire
+5
-5
MRBR_video.js
assets/MRBR_video/scene/MRBR_video.js
+267
-61
No files found.
assets/MRBR_video/prefab/VideoControlBar/js/myVideoControlScript.js
View file @
35ac3460
...
@@ -23,8 +23,14 @@ cc.Class({
...
@@ -23,8 +23,14 @@ cc.Class({
playBtn
:
null
,
// 播放按钮
playBtn
:
null
,
// 播放按钮
pauseBtn
:
null
,
// 暂停按钮
pauseBtn
:
null
,
// 暂停按钮
replayBtn
:
null
,
// 重播按钮
replayBtn
:
null
,
// 重播按钮
properties
:
{
setTimeoutIDs
:
[],
setIntervalIDs
:
[],
},
init
()
{
init
()
{
console
.
log
(
"
Init video control component.
"
)
//
console.log("Init video control component.")
this
.
bgProgress
=
cc
.
find
(
'
progress
'
,
this
.
node
);
this
.
bgProgress
=
cc
.
find
(
'
progress
'
,
this
.
node
);
this
.
bar
=
cc
.
find
(
'
progress/bar
'
,
this
.
node
);
this
.
bar
=
cc
.
find
(
'
progress/bar
'
,
this
.
node
);
this
.
dragBtn
=
cc
.
find
(
'
dragButton
'
,
this
.
node
);
this
.
dragBtn
=
cc
.
find
(
'
dragButton
'
,
this
.
node
);
...
@@ -80,9 +86,8 @@ cc.Class({
...
@@ -80,9 +86,8 @@ cc.Class({
this
.
node
.
emit
(
'
on_drag_percent
'
,
percent
)
this
.
node
.
emit
(
'
on_drag_percent
'
,
percent
)
});
});
this
.
dragBtn
.
off
(
cc
.
Node
.
EventType
.
TOUCH_ENDED
);
this
.
dragBtn
.
off
(
cc
.
Node
.
EventType
.
TOUCH_END
);
this
.
dragBtn
.
on
(
cc
.
Node
.
EventType
.
TOUCH_ENDED
,
(
e
)
=>
{
this
.
dragBtn
.
on
(
cc
.
Node
.
EventType
.
TOUCH_END
,
(
e
)
=>
{
// console.log("用户抬手-1");
if
(
this
.
userDragStart
)
{
if
(
this
.
userDragStart
)
{
this
.
userDragStart
=
false
;
this
.
userDragStart
=
false
;
this
.
node
.
emit
(
'
on_drag_button
'
,
false
);
this
.
node
.
emit
(
'
on_drag_button
'
,
false
);
...
@@ -91,7 +96,6 @@ cc.Class({
...
@@ -91,7 +96,6 @@ cc.Class({
this
.
dragBtn
.
off
(
cc
.
Node
.
EventType
.
MOUSE_UP
);
this
.
dragBtn
.
off
(
cc
.
Node
.
EventType
.
MOUSE_UP
);
this
.
dragBtn
.
on
(
cc
.
Node
.
EventType
.
MOUSE_UP
,
(
e
)
=>
{
this
.
dragBtn
.
on
(
cc
.
Node
.
EventType
.
MOUSE_UP
,
(
e
)
=>
{
// console.log("用户抬手-2");
if
(
this
.
userDragStart
)
{
if
(
this
.
userDragStart
)
{
this
.
userDragStart
=
false
;
this
.
userDragStart
=
false
;
this
.
node
.
emit
(
'
on_drag_button
'
,
false
);
this
.
node
.
emit
(
'
on_drag_button
'
,
false
);
...
@@ -100,7 +104,6 @@ cc.Class({
...
@@ -100,7 +104,6 @@ cc.Class({
this
.
dragBtn
.
off
(
cc
.
Node
.
EventType
.
TOUCH_CANCEL
);
this
.
dragBtn
.
off
(
cc
.
Node
.
EventType
.
TOUCH_CANCEL
);
this
.
dragBtn
.
on
(
cc
.
Node
.
EventType
.
TOUCH_CANCEL
,
(
e
)
=>
{
this
.
dragBtn
.
on
(
cc
.
Node
.
EventType
.
TOUCH_CANCEL
,
(
e
)
=>
{
// console.log("用户抬手-3");
if
(
this
.
userDragStart
)
{
if
(
this
.
userDragStart
)
{
this
.
userDragStart
=
false
;
this
.
userDragStart
=
false
;
this
.
node
.
emit
(
'
on_drag_button
'
,
false
);
this
.
node
.
emit
(
'
on_drag_button
'
,
false
);
...
@@ -108,7 +111,6 @@ cc.Class({
...
@@ -108,7 +111,6 @@ cc.Class({
});
});
},
},
// 0:暂停 1:播放中 2:重播
// 0:暂停 1:播放中 2:重播
videoStatus
:
null
,
videoStatus
:
null
,
refreshVideoBtnState
(
status
)
{
refreshVideoBtnState
(
status
)
{
...
@@ -139,7 +141,7 @@ cc.Class({
...
@@ -139,7 +141,7 @@ cc.Class({
addListener
()
{
addListener
()
{
this
.
node
.
on
(
'
video_play_end
'
,
()
=>
{
this
.
node
.
on
(
'
video_play_end
'
,
()
=>
{
console
.
log
(
"
video_play_end
"
);
//
console.log("video_play_end");
this
.
refreshVideoBtnState
();
this
.
refreshVideoBtnState
();
})
})
...
@@ -153,12 +155,20 @@ cc.Class({
...
@@ -153,12 +155,20 @@ cc.Class({
})
})
this
.
node
.
on
(
'
update_video_status
'
,
(
status
)
=>
{
this
.
node
.
on
(
'
update_video_status
'
,
(
status
)
=>
{
console
.
log
(
"
update_video_status
"
,
status
);
//
console.log("update_video_status", status);
this
.
refreshVideoBtnState
(
status
);
this
.
refreshVideoBtnState
(
status
);
})
})
this
.
node
.
on
(
'
hide_bar
'
,
(
withAnimation
)
=>
{
this
.
hideBar
(
withAnimation
);
})
this
.
node
.
on
(
'
show_bar
'
,
(
withAnimation
)
=>
{
this
.
showBar
(
withAnimation
);
})
this
.
node
.
on
(
"
set_mark_points
"
,
(
data
)
=>
{
this
.
node
.
on
(
"
set_mark_points
"
,
(
data
)
=>
{
console
.
log
(
"
set_mark_points
"
)
//
console.log("set_mark_points")
const
markPoint
=
cc
.
find
(
"
markPoint
"
,
this
.
node
);
const
markPoint
=
cc
.
find
(
"
markPoint
"
,
this
.
node
);
const
markPointsContainer
=
cc
.
find
(
"
markNode
"
,
this
.
node
);
const
markPointsContainer
=
cc
.
find
(
"
markNode
"
,
this
.
node
);
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
)
{
...
@@ -170,6 +180,49 @@ cc.Class({
...
@@ -170,6 +180,49 @@ cc.Class({
})
})
},
},
// 显示进度条
showBar
(
withAnimation
)
{
const
widget
=
this
.
node
.
getComponent
(
cc
.
Widget
);
if
(
withAnimation
)
{
widget
.
bottom
=
-
100
;
let
count
=
10
;
let
step
=
200
/
count
;
const
_intervalId
=
setInterval
(()
=>
{
widget
.
bottom
+=
step
;
count
--
;
if
(
count
<=
0
)
{
widget
.
bottom
=
100
;
clearInterval
(
_intervalId
)
}
},
30
)
this
.
setIntervalIDs
.
push
(
_intervalId
);
}
else
{
widget
.
bottom
=
100
;
}
},
// 隐藏进度条
hideBar
(
withAnimation
)
{
const
widget
=
this
.
node
.
getComponent
(
cc
.
Widget
);
if
(
withAnimation
)
{
widget
.
bottom
=
100
;
let
count
=
10
;
let
step
=
200
/
count
;
const
_intervalId
=
setInterval
(()
=>
{
widget
.
bottom
-=
step
;
count
--
;
if
(
count
<=
0
)
{
widget
.
bottom
=
-
100
;
clearInterval
(
_intervalId
)
}
},
30
)
this
.
setIntervalIDs
.
push
(
_intervalId
);
}
else
{
widget
.
bottom
=
-
100
;
}
},
setProgress
(
progress
)
{
setProgress
(
progress
)
{
const
dragStartX
=
-
520
;
const
dragStartX
=
-
520
;
setTimeout
(()
=>
{
setTimeout
(()
=>
{
...
@@ -180,4 +233,10 @@ cc.Class({
...
@@ -180,4 +233,10 @@ cc.Class({
}
}
},
1
);
},
1
);
},
},
onDestroy
()
{
for
(
let
i
=
0
;
i
<
this
.
setIntervalIDs
.
length
;
i
++
)
{
clearInterval
(
this
.
setIntervalIDs
[
i
]);
}
}
});
});
assets/MRBR_video/scene/MRBR_video.fire
View file @
35ac3460
...
@@ -749,8 +749,8 @@
...
@@ -749,8 +749,8 @@
"__type__": "TypedArray",
"__type__": "TypedArray",
"ctor": "Float64Array",
"ctor": "Float64Array",
"array": [
"array": [
0,
10
0,
-3
2
0,
-3
7
0,
0,
0,
0,
0,
0,
0,
...
@@ -1697,15 +1697,15 @@
...
@@ -1697,15 +1697,15 @@
"__id__": 15
"__id__": 15
},
},
"_enabled": true,
"_enabled": true,
"alignMode":
1
,
"alignMode":
2
,
"_target": null,
"_target": null,
"_alignFlags": 20,
"_alignFlags": 20,
"_left": 0,
"_left": 0,
"_right": 0,
"_right": 0,
"_top": 100,
"_top": 100,
"_bottom": 1
5
0,
"_bottom": 1
0
0,
"_verticalCenter": 0,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_horizontalCenter":
10
0,
"_isAbsLeft": true,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsTop": true,
...
...
assets/MRBR_video/scene/MRBR_video.js
View file @
35ac3460
This diff is collapsed.
Click to expand it.
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