Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dg29_museum
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
dg29_museum
Commits
8903d1c1
Commit
8903d1c1
authored
Dec 31, 2023
by
Tt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改视频加载方式
parent
c2b1b7a9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
5 deletions
+20
-5
dg29_museum.ts
assets/dg29_museum/scene/dg29_museum.ts
+20
-5
No files found.
assets/dg29_museum/scene/dg29_museum.ts
View file @
8903d1c1
...
@@ -390,11 +390,29 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -390,11 +390,29 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
layout_video
.
active
=
false
;
this
.
layout_video
.
active
=
false
;
this
.
showUI
();
this
.
showUI
();
}
}
initVideoPlayer
()
{
@
property
(
cc
.
Node
)
touchlayer
:
cc
.
Node
=
null
;
initVideoUrl
()
{
this
.
prepared
=
true
;
this
.
touchlayer
.
on
(
cc
.
Node
.
EventType
.
TOUCH_START
,
this
.
tryPlayVideo
,
this
)
this
.
videoPlayer
.
node
.
active
=
true
;
this
.
videoPlayer
.
node
.
active
=
true
;
this
.
videoPlayer
.
remoteURL
=
this
.
data
.
video_url
;
this
.
videoPlayer
.
remoteURL
=
this
.
data
.
video_url
;
this
.
videoPlayer
.
resourceType
=
cc
.
VideoPlayer
.
ResourceType
.
REMOTE
;
this
.
videoPlayer
.
resourceType
=
cc
.
VideoPlayer
.
ResourceType
.
REMOTE
;
}
private
prepared
:
boolean
;
tryPlayVideo
()
{
cc
.
log
(
"
touch layer--
"
)
if
(
this
.
prepared
)
{
this
.
prepared
=
false
;
this
.
videoPlayer
.
volume
=
0
;
this
.
videoPlayer
.
play
();
this
.
scheduleOnce
(()
=>
{
this
.
videoPlayer
.
volume
=
1
;
this
.
videoPlayer
.
pause
();
},
1
)
}
}
initVideoPlayer
()
{
this
.
videoPlayer
.
node
.
x
=
-
10000
;
this
.
videoPlayer
.
node
.
x
=
-
10000
;
this
.
videoPlayer
.
node
.
y
=
-
10000
;
this
.
videoPlayer
.
node
.
y
=
-
10000
;
this
.
layout_video
.
active
=
false
;
this
.
layout_video
.
active
=
false
;
...
@@ -403,7 +421,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -403,7 +421,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
_isReadyToPlay
=
true
;
this
.
_isReadyToPlay
=
true
;
this
.
_isPlayComplated
=
false
;
this
.
_isPlayComplated
=
false
;
this
.
videoPlayer
.
currentTime
=
0
;
this
.
videoPlayer
.
currentTime
=
0
;
this
.
play
();
});
});
this
.
videoPlayer
.
node
.
on
(
'
meta-loaded
'
,
()
=>
{
this
.
videoPlayer
.
node
.
on
(
'
meta-loaded
'
,
()
=>
{
console
.
log
(
'
meta-loaded
'
);
console
.
log
(
'
meta-loaded
'
);
...
@@ -565,9 +582,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -565,9 +582,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
play
()
{
play
()
{
if
(
!
this
.
_isReadyToPlay
)
{
if
(
!
this
.
_isReadyToPlay
)
return
;
return
;
}
this
.
videoPlayer
.
play
();
this
.
videoPlayer
.
play
();
}
}
pause
()
{
pause
()
{
...
...
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