Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
JJ38
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
JJ38
Commits
c9f6b7c7
Commit
c9f6b7c7
authored
Jun 03, 2024
by
limingzhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: debug
parent
dda2d29b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
22 deletions
+16
-22
.DS_Store
.DS_Store
+0
-0
JJ38.js
assets/JJ38/scene/JJ38.js
+16
-22
No files found.
.DS_Store
View file @
c9f6b7c7
No preview for this file type
assets/JJ38/scene/JJ38.js
View file @
c9f6b7c7
...
...
@@ -469,13 +469,19 @@ cc.Class({
this
.
progressBtn
.
on
(
'
touchstart
'
,
(
e
)
=>
{});
let
audioClip
;
let
totalTimeAudioId
;
cc
.
assetManager
.
loadRemote
(
this
.
data
.
audio_url
,
(
err
,
_audioClip
)
=>
{
audioClip
=
_audioClip
;
this
.
totalTime
=
audioClip
.
duration
;
totalTimeLabel
.
string
=
this
.
formatTime
(
this
.
totalTime
*
1000
);
if
(
!
this
.
totalTime
)
{
totalTimeAudioId
=
cc
.
audioEngine
.
play
(
audioClip
,
false
,
0
);
checkHasDuration
();
}
this
.
audioId
=
cc
.
audioEngine
.
play
(
audioClip
,
false
,
0.8
);
checkIsPlaying
();
// setTimeout(() => {
// if (this.isDestroy) {
...
...
@@ -488,13 +494,13 @@ cc.Class({
const
check
IsPlaying
=
()
=>
{
const
check
HasDuration
=
()
=>
{
const
timerId
=
setTimeout
(()
=>
{
setTimeout
(()
=>
{
console
.
log
(
'
in checkIsPlaying 1
'
)
if
(
t
his
.
a
udioId
==
null
)
{
if
(
t
otalTimeA
udioId
==
null
)
{
return
;
}
...
...
@@ -502,24 +508,12 @@ cc.Class({
return
;
}
const
curTime
=
cc
.
audioEngine
.
getCurrentTime
(
this
.
audioId
);
if
(
curTime
)
{
let
duration
=
cc
.
audioEngine
.
getDuration
(
audioId
);
console
.
log
(
'
curTime:
'
+
curTime
);
console
.
log
(
'
duration:
'
+
duration
);
console
.
log
(
'
audioClip.duration:
'
+
audioClip
.
duration
);
let
duration
=
cc
.
audioEngine
.
getDuration
(
totalTimeAudioId
);
if
(
!
duration
)
{
duration
=
audioClip
.
duration
||
0
;
}
if
(
duration
)
{
// if (!duration) {
// checkIsPlaying();
// return;
// }
cc
.
audioEngine
.
stop
(
t
his
.
a
udioId
);
cc
.
audioEngine
.
stop
(
t
otalTimeA
udioId
);
this
.
totalTime
=
duration
;
totalTimeLabel
.
string
=
this
.
formatTime
(
duration
*
1000
);
...
...
@@ -528,7 +522,7 @@ cc.Class({
checkIsPlaying
();
}
},
1
);
},
300
);
}
...
...
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