Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
JM_4-2
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
JM_4-2
Commits
73fa2b2a
Commit
73fa2b2a
authored
Aug 18, 2021
by
范雪寒
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 多次点击喇叭
parent
af45e245
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14263 additions
and
6 deletions
+14263
-6
package-lock.json
package-lock.json
+14240
-0
play.component.ts
src/app/play/play.component.ts
+23
-6
No files found.
package-lock.json
0 → 100644
View file @
73fa2b2a
This diff is collapsed.
Click to expand it.
src/app/play/play.component.ts
View file @
73fa2b2a
...
...
@@ -632,24 +632,41 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
soundStyleMarginL
=
-
this
.
curSoundIconIndex
*
100
+
'
%
'
}
currentAudio
=
null
;
currentAudioCallback
=
null
;
playSentenceAudio
()
{
const
mp3Url
=
this
.
curSentenceData
.
audio_url
if
(
!
mp3Url
)
{
return
;
}
if
(
this
.
currentAudio
)
{
this
.
currentAudio
.
pause
();
if
(
this
.
currentAudioCallback
)
{
this
.
currentAudioCallback
();
this
.
currentAudioCallback
=
null
;
}
}
const
mp3
=
new
Audio
(
mp3Url
);
mp3
.
play
();
//播放 mp3这个音频对象
this
.
currentAudio
=
mp3
;
this
.
currentAudioCallback
=
()
=>
{
this
.
stopSoundAnim
();
if
(
!
this
.
isCountDownStart
)
{
this
.
countDownStart
();
}
};
mp3
.
addEventListener
(
"
ended
"
,
()
=>
{
this
.
stopSoundAnim
();
if
(
!
this
.
isCountDownStart
)
{
this
.
countDownStart
()
;
}
if
(
this
.
currentAudioCallback
)
{
this
.
currentAudioCallback
();
this
.
currentAudioCallback
=
null
;
}
});
this
.
showSoundAnim
();
}
playHtmlAudio
(
mp3Url
,
cb
=
null
)
{
...
...
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