Commit c5965d70 authored by limingzhe's avatar limingzhe

fix: 直播一次 移动端 音效

parent c210d69c
...@@ -142,7 +142,9 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -142,7 +142,9 @@ export class PlayComponent implements OnInit, OnDestroy {
// await loadFonts(); await loadFonts('DroidSansFallback', 'DroidSansFallback.ttf');
await loadFonts('Aileron-Black', 'Aileron-Black.ttf');
await loadFonts('Aileron-Bold', 'Aileron-Bold.ttf');
const getData = (<any>window).courseware.getData; const getData = (<any>window).courseware.getData;
getData((data, aspect) => { getData((data, aspect) => {
...@@ -446,18 +448,10 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -446,18 +448,10 @@ export class PlayComponent implements OnInit, OnDestroy {
this.loadResources().then(() => { this.loadResources().then(() => {
// this.setfontData(); // this.setfontData();
console.log('aaaaaa');
loadFonts('DroidSansFallback', 'DroidSansFallback.ttf').then( () => { this.addServerListener();
window['air'].hideAirClassLoading(this.KEY, this.data);
console.log('bbbbb');
loadFonts('Aileron-Black', 'Aileron-Black.ttf').then( () => {
console.log('cccc');
this.addServerListener();
window['air'].hideAirClassLoading(this.KEY, this.data);
})
})
}); });
...@@ -2079,17 +2073,23 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -2079,17 +2073,23 @@ export class PlayComponent implements OnInit, OnDestroy {
const audio = this.audioObj[key]; const audio = this.audioObj[key];
if (audio) { if (audio) {
if (now) {
audio.pause();
audio.currentTime = 0;
}
if (callback) { const audioNew = new Audio();
audio.onended = () => { audioNew.src = audio.src;
callback(); audioNew.load();
}; audioNew.play();
}
audio.play(); // if (now) {
// audio.pause();
// audio.currentTime = 0;
// }
// if (callback) {
// audio.onended = () => {
// callback();
// };
// }
// audio.play();
} }
} }
......
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