mirror of
https://github.com/overte-org/overte.git
synced 2025-04-08 07:12:40 +02:00
Code review
This commit is contained in:
parent
021c3dff32
commit
f74e29e4b0
1 changed files with 12 additions and 7 deletions
|
@ -368,16 +368,21 @@
|
|||
};
|
||||
}());
|
||||
|
||||
function sendHeartbeat(isOneShot) {
|
||||
function sendHeartbeat() {
|
||||
Messages.sendMessage(HIFI_RECORDER_CHANNEL, JSON.stringify({
|
||||
playing: Player.isPlaying(),
|
||||
recording: Player.recording(),
|
||||
entity: Entity.id()
|
||||
}));
|
||||
}
|
||||
|
||||
if (!isOneShot) {
|
||||
heartbeatTimer = Script.setTimeout(sendHeartbeat, HEARTBEAT_INTERVAL);
|
||||
}
|
||||
function onHeartbeatTimer() {
|
||||
sendHeartbeat();
|
||||
heartbeatTimer = Script.setTimeout(onHeartbeatTimer, HEARTBEAT_INTERVAL);
|
||||
}
|
||||
|
||||
function startHeartbeat() {
|
||||
onHeartbeatTimer();
|
||||
}
|
||||
|
||||
function stopHeartbeat() {
|
||||
|
@ -401,12 +406,12 @@
|
|||
} else {
|
||||
log("Didn't start playing " + message.recording + " because already playing " + Player.recording());
|
||||
}
|
||||
sendHeartbeat(true);
|
||||
sendHeartbeat();
|
||||
break;
|
||||
case PLAYER_COMMAND_STOP:
|
||||
Player.stop();
|
||||
Player.autoPlay(); // There may be another recording to play.
|
||||
sendHeartbeat(true);
|
||||
sendHeartbeat();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -421,7 +426,7 @@
|
|||
Messages.subscribe(HIFI_PLAYER_CHANNEL);
|
||||
|
||||
Player.autoPlay();
|
||||
sendHeartbeat();
|
||||
startHeartbeat();
|
||||
|
||||
UserActivityLogger.logAction("playRecordingAC_script_load");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue