Commit daf8bf4d authored by Li Mingzhe's avatar Li Mingzhe

feat: 优化音频卡住

parent 786a04a9
...@@ -212,6 +212,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -212,6 +212,7 @@ export class PlayComponent implements OnInit, OnDestroy {
showPetalFlag; showPetalFlag;
bg; bg;
delayPicSoundShowTime = 700;
...@@ -335,6 +336,9 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -335,6 +336,9 @@ export class PlayComponent implements OnInit, OnDestroy {
const contentObj = this.data.contentObj; const contentObj = this.data.contentObj;
if (!contentObj) { return; } if (!contentObj) { return; }
const picArr = contentObj.picArr;
console.log(' this.data: ', this.data);
// const addAudio = (key) => { // const addAudio = (key) => {
...@@ -347,10 +351,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -347,10 +351,7 @@ export class PlayComponent implements OnInit, OnDestroy {
// } // }
// } // }
// //
// for (let i = 0; i < 4; i ++) {
// const key = i + '_audio_url';
// addAudio(key);
// }
// //
// addAudio('audio_url'); // addAudio('audio_url');
// //
...@@ -366,13 +367,13 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -366,13 +367,13 @@ export class PlayComponent implements OnInit, OnDestroy {
audio.load(); audio.load();
this.audioObj[audioUrl] = audio; this.audioObj[audioUrl] = audio;
} }
}; };
const arr = contentObj.picArr; const arr = contentObj.picArr;
if (arr) { if (arr) {
console.log('arr: ', arr);
for (let i = 0; i < arr.length; i++) { for (let i = 0; i < arr.length; i++) {
addUrlToAudioObj(arr[i].audio_url); addUrlToAudioObj(arr[i].audio_url);
} }
...@@ -2046,7 +2047,6 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -2046,7 +2047,6 @@ export class PlayComponent implements OnInit, OnDestroy {
} }
showPicSound() { showPicSound() {
this.canTouch = false; this.canTouch = false;
...@@ -2067,13 +2067,17 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -2067,13 +2067,17 @@ export class PlayComponent implements OnInit, OnDestroy {
audio.onended = () => { audio.onended = () => {
setTimeout(() => { setTimeout(() => {
this.showPicSound(); this.showPicSound();
}, 0.7 * 1000); }, this.delayPicSoundShowTime);
}; };
audio.play(); audio.play();
this.answerIdIndex ++; } else {
this.showPicSound();
} }
this.answerIdIndex ++;
} }
......
...@@ -9,6 +9,10 @@ ...@@ -9,6 +9,10 @@
<link rel="icon" type="image/x-icon" href="favicon.ico"> <link rel="icon" type="image/x-icon" href="favicon.ico">
<script type="text/javascript" src="http://teach.cdn.ireadabc.com/h5template/h5-static-lib/js/air.js"></script> <script type="text/javascript" src="http://teach.cdn.ireadabc.com/h5template/h5-static-lib/js/air.js"></script>
<script src="https://cdn.bootcss.com/vConsole/3.3.4/vconsole.min.js"></script>
<script>
var vConsole = new VConsole();
</script>
</head> </head>
<body> <body>
<app-root></app-root> <app-root></app-root>
......
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