Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dfzx_mb_02
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
dfzx_mb_02
Commits
6c49ff4a
Commit
6c49ff4a
authored
Oct 27, 2020
by
liujiangnan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 音频播放
parent
01e01555
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
11 deletions
+29
-11
play.component.ts
src/app/play/play.component.ts
+29
-11
audio1.mp3
src/assets/default/audio1.mp3
+0
-0
audio2.mp3
src/assets/default/audio2.mp3
+0
-0
audio3.mp3
src/assets/default/audio3.mp3
+0
-0
audio4.mp3
src/assets/default/audio4.mp3
+0
-0
No files found.
src/app/play/play.component.ts
View file @
6c49ff4a
...
@@ -267,12 +267,22 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -267,12 +267,22 @@ export class PlayComponent implements OnInit, OnDestroy {
if
(
!
picArr
)
{
if
(
!
picArr
)
{
const
picArr
=
[];
const
picArr
=
[];
for
(
let
i
=
0
;
i
<
4
;
i
++
)
{
picArr
.
push
({
picArr
.
push
({
pic_url
:
'
assets/default/item.png
'
,
pic_url
:
'
assets/default/item.png
'
,
audio_url
:
'
assets/default/audio.mp3
'
audio_url
:
'
assets/default/audio1.mp3
'
});
picArr
.
push
({
pic_url
:
'
assets/default/item.png
'
,
audio_url
:
'
assets/default/audio2.mp3
'
});
picArr
.
push
({
pic_url
:
'
assets/default/item.png
'
,
audio_url
:
'
assets/default/audio3.mp3
'
});
picArr
.
push
({
pic_url
:
'
assets/default/item.png
'
,
audio_url
:
'
assets/default/audio4.mp3
'
});
});
}
this
.
data
.
contentObj
.
picArr
=
picArr
;
this
.
data
.
contentObj
.
picArr
=
picArr
;
...
@@ -1857,9 +1867,9 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -1857,9 +1867,9 @@ export class PlayComponent implements OnInit, OnDestroy {
if
(
this
.
checkAllCardClicked
())
{
if
(
this
.
checkAllCardClicked
())
{
return
;
return
;
}
}
this
.
soundPlay
.
visible
=
false
;
this
.
soundPlay
.
visible
=
false
;
this
.
soundReplay
.
visible
=
false
;
this
.
soundReplay
.
visible
=
false
;
this
.
setAudioAllReadyPlay
();
this
.
answerIdIndex
=
0
;
this
.
answerIdIndex
=
0
;
this
.
showPicSound
();
this
.
showPicSound
();
}
}
...
@@ -2049,6 +2059,14 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -2049,6 +2059,14 @@ export class PlayComponent implements OnInit, OnDestroy {
return
icon
;
return
icon
;
}
}
setAudioAllReadyPlay
()
{
for
(
let
i
=
0
;
i
<
this
.
picArr
.
length
;
i
++
)
{
const
item
=
this
.
picArr
[
i
];
let
audio
=
this
.
audioObj
[
item
.
audio_url
];
audio
.
play
();
audio
.
pause
();
}
}
showPicSound
()
{
showPicSound
()
{
...
@@ -2069,10 +2087,10 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -2069,10 +2087,10 @@ export class PlayComponent implements OnInit, OnDestroy {
console
.
log
(
'
answerIdIndex:
'
,
this
.
answerIdIndex
);
console
.
log
(
'
answerIdIndex:
'
,
this
.
answerIdIndex
);
console
.
log
(
'
audio:
'
,
audio
)
console
.
log
(
'
audio:
'
,
audio
)
audio
=
new
Audio
();
//
audio = new Audio();
audio
.
play
();
//
audio.play();
audio
.
pause
();
//
audio.pause();
audio
.
src
=
curData
.
audio_url
;
//
audio.src = curData.audio_url;
if
(
!
audio
.
hasEndedEvent
)
{
if
(
!
audio
.
hasEndedEvent
)
{
...
...
src/assets/default/audio.mp3
→
src/assets/default/audio
1
.mp3
View file @
6c49ff4a
File moved
src/assets/default/audio2.mp3
0 → 100755
View file @
6c49ff4a
File added
src/assets/default/audio3.mp3
0 → 100755
View file @
6c49ff4a
File added
src/assets/default/audio4.mp3
0 → 100755
View file @
6c49ff4a
File added
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