Add a "record" button to initiate recording

This commit is contained in:
David Rowe 2017-04-12 15:04:29 +12:00
parent 905560b96d
commit f30dc4b560
3 changed files with 24 additions and 2 deletions

View file

@ -16,12 +16,14 @@ var isUsingToolbar = false,
elRecordingsPlaying, elRecordingsPlaying,
elNumberOfPlayers, elNumberOfPlayers,
elLoadButton, elLoadButton,
elRecordButton,
EVENT_BRIDGE_TYPE = "record", EVENT_BRIDGE_TYPE = "record",
BODY_LOADED_ACTION = "bodyLoaded", BODY_LOADED_ACTION = "bodyLoaded",
RECORDINGS_BEING_PLAYED_ACTION = "recordingsBeingPlayed", RECORDINGS_BEING_PLAYED_ACTION = "recordingsBeingPlayed",
NUMBER_OF_PLAYERS_ACTION = "numberOfPlayers", NUMBER_OF_PLAYERS_ACTION = "numberOfPlayers",
STOP_PLAYING_RECORDING_ACTION = "stopPlayingRecording", STOP_PLAYING_RECORDING_ACTION = "stopPlayingRecording",
LOAD_RECORDING_ACTION = "loadRecording"; LOAD_RECORDING_ACTION = "loadRecording",
START_RECORDING_ACTION = "startRecording";
function stopPlayingRecording(event) { function stopPlayingRecording(event) {
var playerID = event.target.getElementsByTagName("input")[0].value; var playerID = event.target.getElementsByTagName("input")[0].value;
@ -111,6 +113,14 @@ function onBodyLoaded() {
})); }));
} }
elRecordButton = document.getElementById("record-button");
elRecordButton.onclick = function () {
EventBridge.emitWebEvent(JSON.stringify({
type: EVENT_BRIDGE_TYPE,
action: START_RECORDING_ACTION
}));
}
EventBridge.emitWebEvent(JSON.stringify({ EventBridge.emitWebEvent(JSON.stringify({
type: EVENT_BRIDGE_TYPE, type: EVENT_BRIDGE_TYPE,
action: BODY_LOADED_ACTION action: BODY_LOADED_ACTION

View file

@ -37,6 +37,9 @@
<div> <div>
<input id="load-button" type="button" value="Load" disabled /> <input id="load-button" type="button" value="Load" disabled />
</div> </div>
<div>
<input id="record-button" class="red" type="button" value="Record" />
</div>
<script> <script>
onBodyLoaded(); onBodyLoaded();
</script> </script>

View file

@ -400,7 +400,8 @@
RECORDINGS_BEING_PLAYED_ACTION = "recordingsBeingPlayed", RECORDINGS_BEING_PLAYED_ACTION = "recordingsBeingPlayed",
NUMBER_OF_PLAYERS_ACTION = "numberOfPlayers", NUMBER_OF_PLAYERS_ACTION = "numberOfPlayers",
STOP_PLAYING_RECORDING_ACTION = "stopPlayingRecording", STOP_PLAYING_RECORDING_ACTION = "stopPlayingRecording",
LOAD_RECORDING_ACTION = "loadRecording"; LOAD_RECORDING_ACTION = "loadRecording",
START_RECORDING_ACTION = "startRecording";
function onWebEventReceived(data) { function onWebEventReceived(data) {
var message = JSON.parse(data); var message = JSON.parse(data);
@ -422,6 +423,14 @@
// User wants to select an ATP recording to play. // User wants to select an ATP recording to play.
log("TODO: Open dialog for user to select ATP recording to play"); log("TODO: Open dialog for user to select ATP recording to play");
break; break;
case START_RECORDING_ACTION:
// Start making a recording.
tablet.gotoHomeScreen(); // Closes window dialog.
HMD.closeTablet();
if (Recorder.isIdle()) {
Recorder.startCountdown();
}
break;
} }
} }
} }