Commit caae671e authored by limingzhe's avatar limingzhe

Merge branch 'master' of http://vcs.ireadabc.com/template/JM_4-2

parents 4676b2be 73fa2b2a
This diff is collapsed.
......@@ -656,24 +656,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这个音频对象
mp3.addEventListener("ended", () => {
this.currentAudio = mp3;
this.currentAudioCallback = () => {
this.stopSoundAnim();
if (!this.isCountDownStart) {
this.countDownStart();
}
});
};
mp3.addEventListener("ended", () => {
if (this.currentAudioCallback) {
this.currentAudioCallback();
this.currentAudioCallback = null;
}
});
this.showSoundAnim();
}
playHtmlAudio(mp3Url, cb=null) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment