Commit 166e3291 authored by Chen Jiping's avatar Chen Jiping

fix:修复音频材料播放

parent 569cbdd4
...@@ -360,7 +360,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -360,7 +360,7 @@ export class PlayComponent implements OnInit, OnDestroy {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const audio = new Audio(); const audio = new Audio();
audio.oncanplay = (a) => { audio.oncanplay = (a) => {
resolve(); resolve(a);
}; };
audio.onerror = () => { audio.onerror = () => {
reject(); reject();
...@@ -615,16 +615,15 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -615,16 +615,15 @@ export class PlayComponent implements OnInit, OnDestroy {
this.bgAudio.pause(); this.bgAudio.pause();
} }
this.bgAudio = this.playAudio(this.curExercises.audio_url, true); this.bgAudio = this.playAudio(this.curExercises.audio_url, true, () =>{
this.timeId = setTimeout(() => {
this.timeId = setTimeout(() => {
if (!this.finished) {
this.playBgAudio();
}
}, 3000);
if (!this.finished) {
this.playBgAudio();
}
}, 3000);
});
} }
......
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