Commit 83e23f5b authored by limingzhe's avatar limingzhe

update startBtn touch enable

parent 6c59cff2
......@@ -218,15 +218,27 @@ export class PlayComponent implements OnInit, OnDestroy {
load() {
// window["air"].hideAirClassLoading(this.saveKey, this.data);
// console.log('in load 1');
this.loadResources().then(() => {
// console.log('in load 2');
this.init();
// console.log('in load 3');
this.update();
// console.log('in load 4');
this.addServerListener();
// console.log('in load 5');
window["air"].hideAirClassLoading(this.saveKey, this.data);
// console.log('in load 6');
});
}
......@@ -273,6 +285,7 @@ export class PlayComponent implements OnInit, OnDestroy {
const c = (<any> window).courseware;
c.onEvent('userchange', (data, next) => {
//data的结构如下
/*{
......@@ -336,6 +349,8 @@ export class PlayComponent implements OnInit, OnDestroy {
this.teacherPage.visible = true;
}
this.canTouch = true;
next();
});
......@@ -394,7 +409,6 @@ export class PlayComponent implements OnInit, OnDestroy {
this.addTeacherPageData(data);
}
next();
});
......@@ -600,19 +614,25 @@ export class PlayComponent implements OnInit, OnDestroy {
playAudio(key, now = false, callback = null) {
const audio = this.audioObj[key];
if (audio) {
if (now) {
audio.pause();
audio.currentTime = 0;
}
if (callback) {
audio.onended = () => {
callback();
};
try {
if (audio) {
if (now) {
audio.pause();
audio.currentTime = 0;
}
if (callback) {
audio.onended = () => {
callback();
};
}
audio.play();
}
audio.play();
} catch (e) {
console.log('e: ', e);
}
}
......@@ -656,14 +676,21 @@ export class PlayComponent implements OnInit, OnDestroy {
preloadAudio(url) {
return new Promise((resolve, reject) => {
const audio = new Audio();
audio.oncanplay = (a) => {
resolve();
};
// audio.addEventListener('loadedmetadata', () => {
// resolve();
// });
// audio.oncanplay = (a) => {
// resolve();
// };
audio.onerror = () => {
reject();
};
audio.src = url;
audio.load();
resolve();
});
}
......@@ -884,8 +911,6 @@ export class PlayComponent implements OnInit, OnDestroy {
this.syncPage();
}
syncPage() {
......@@ -2554,6 +2579,8 @@ export class PlayComponent implements OnInit, OnDestroy {
this.sendServerEvent('startGame', {roleData, roleIndex, wordArr, gameResultArr, date, start: true});
this.canTouch = false;
}
sendServerNewRound() {
......
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