mirror of
https://github.com/overte-org/overte.git
synced 2025-04-18 18:37:00 +02:00
Remove checkbox and record-on-close functionality
This commit is contained in:
parent
3ae388bded
commit
905560b96d
3 changed files with 8 additions and 87 deletions
|
@ -13,25 +13,15 @@
|
|||
var isUsingToolbar = false,
|
||||
numberOfPlayers = 0,
|
||||
recordingsBeingPlayed = [],
|
||||
elEnableRecording,
|
||||
elInstructions,
|
||||
elRecordingsPlaying,
|
||||
elNumberOfPlayers,
|
||||
elLoadButton,
|
||||
EVENT_BRIDGE_TYPE = "record",
|
||||
BODY_LOADED_ACTION = "bodyLoaded",
|
||||
USING_TOOLBAR_ACTION = "usingToolbar",
|
||||
ENABLE_RECORDING_ACTION = "enableRecording",
|
||||
RECORDINGS_BEING_PLAYED_ACTION = "recordingsBeingPlayed",
|
||||
NUMBER_OF_PLAYERS_ACTION = "numberOfPlayers",
|
||||
STOP_PLAYING_RECORDING_ACTION = "stopPlayingRecording",
|
||||
LOAD_RECORDING_ACTION = "loadRecording",
|
||||
TABLET_INSTRUCTIONS = "Close the tablet to start recording",
|
||||
WINDOW_INSTRUCTIONS = "Close the window to start recording";
|
||||
|
||||
function updateInstructions() {
|
||||
elInstructions.innerHTML = elEnableRecording.checked ? (isUsingToolbar ? WINDOW_INSTRUCTIONS : TABLET_INSTRUCTIONS) : "";
|
||||
}
|
||||
LOAD_RECORDING_ACTION = "loadRecording";
|
||||
|
||||
function stopPlayingRecording(event) {
|
||||
var playerID = event.target.getElementsByTagName("input")[0].value;
|
||||
|
@ -92,14 +82,6 @@ function onScriptEventReceived(data) {
|
|||
var message = JSON.parse(data);
|
||||
if (message.type === EVENT_BRIDGE_TYPE) {
|
||||
switch (message.action) {
|
||||
case ENABLE_RECORDING_ACTION:
|
||||
elEnableRecording.checked = message.value;
|
||||
updateInstructions();
|
||||
break;
|
||||
case USING_TOOLBAR_ACTION:
|
||||
isUsingToolbar = message.value;
|
||||
updateInstructions();
|
||||
break;
|
||||
case RECORDINGS_BEING_PLAYED_ACTION:
|
||||
recordingsBeingPlayed = JSON.parse(message.value);
|
||||
updateRecordings();
|
||||
|
@ -118,17 +100,6 @@ function onBodyLoaded() {
|
|||
|
||||
EventBridge.scriptEventReceived.connect(onScriptEventReceived);
|
||||
|
||||
elEnableRecording = document.getElementById("enable-recording");
|
||||
elEnableRecording.onchange = function () {
|
||||
updateInstructions();
|
||||
EventBridge.emitWebEvent(JSON.stringify({
|
||||
type: EVENT_BRIDGE_TYPE,
|
||||
action: ENABLE_RECORDING_ACTION,
|
||||
value: elEnableRecording.checked
|
||||
}));
|
||||
};
|
||||
|
||||
elInstructions = document.getElementById("instructions");
|
||||
elRecordingsPlaying = document.getElementById("recordings-playing");
|
||||
elNumberOfPlayers = document.getElementById("number-of-players");
|
||||
|
||||
|
|
|
@ -19,13 +19,6 @@
|
|||
<div class="title">
|
||||
<label>Record</label>
|
||||
</div>
|
||||
<div class="property checkbox">
|
||||
<input type="checkbox" id="enable-recording">
|
||||
<label for="enable-recording">Enable recording</label>
|
||||
</div>
|
||||
<div class="instructions">
|
||||
<p id="instructions"></p>
|
||||
</div>
|
||||
<div>
|
||||
<table id="recordings-playing">
|
||||
<thead>
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
APP_ICON_ACTIVE = "icons/tablet-icons/edit-a.svg", // FIXME: Record icon.
|
||||
APP_URL = Script.resolvePath("html/record.html"),
|
||||
isDialogDisplayed = false,
|
||||
isRecordingEnabled = false,
|
||||
tablet,
|
||||
button,
|
||||
|
||||
|
@ -26,10 +25,6 @@
|
|||
Player,
|
||||
Dialog;
|
||||
|
||||
function updateButtonState() {
|
||||
button.editProperties({ isActive: isRecordingEnabled || !Recorder.isIdle() });
|
||||
}
|
||||
|
||||
function log(message) {
|
||||
print(APP_NAME + ": " + message);
|
||||
}
|
||||
|
@ -40,11 +35,6 @@
|
|||
|
||||
}
|
||||
|
||||
function isUsingToolbar() {
|
||||
return ((HMD.active && Settings.getValue("hmdTabletBecomesToolbar"))
|
||||
|| (!HMD.active && Settings.getValue("desktopTabletBecomesToolbar")));
|
||||
}
|
||||
|
||||
CountdownTimer = (function () {
|
||||
// Displays countdown overlay.
|
||||
|
||||
|
@ -205,7 +195,6 @@
|
|||
|
||||
function startRecording() {
|
||||
recordingState = RECORDING;
|
||||
updateButtonState();
|
||||
log("Start recording");
|
||||
startPosition = MyAvatar.position;
|
||||
startOrientation = MyAvatar.orientation;
|
||||
|
@ -217,7 +206,6 @@
|
|||
error;
|
||||
|
||||
recordingState = IDLE;
|
||||
updateButtonState();
|
||||
log("Finish recording");
|
||||
Recording.stopRecording();
|
||||
success = Recording.saveRecordingToAsset(saveRecordingToAssetCallback);
|
||||
|
@ -229,26 +217,22 @@
|
|||
function cancelRecording() {
|
||||
Recording.stopRecording();
|
||||
recordingState = IDLE;
|
||||
updateButtonState();
|
||||
log("Cancel recording");
|
||||
}
|
||||
|
||||
function finishCountdown() {
|
||||
recordingState = RECORDING;
|
||||
updateButtonState();
|
||||
startRecording();
|
||||
}
|
||||
|
||||
function cancelCountdown() {
|
||||
recordingState = IDLE;
|
||||
updateButtonState();
|
||||
CountdownTimer.cancel();
|
||||
log("Cancel countdown");
|
||||
}
|
||||
|
||||
function startCountdown() {
|
||||
recordingState = COUNTING_DOWN;
|
||||
updateButtonState();
|
||||
log("Start countdown");
|
||||
CountdownTimer.start(finishCountdown);
|
||||
}
|
||||
|
@ -413,8 +397,6 @@
|
|||
Dialog = (function () {
|
||||
var EVENT_BRIDGE_TYPE = "record",
|
||||
BODY_LOADED_ACTION = "bodyLoaded",
|
||||
USING_TOOLBAR_ACTION = "usingToolbar",
|
||||
ENABLE_RECORDING_ACTION = "enableRecording",
|
||||
RECORDINGS_BEING_PLAYED_ACTION = "recordingsBeingPlayed",
|
||||
NUMBER_OF_PLAYERS_ACTION = "numberOfPlayers",
|
||||
STOP_PLAYING_RECORDING_ACTION = "stopPlayingRecording",
|
||||
|
@ -426,28 +408,12 @@
|
|||
switch (message.action) {
|
||||
case BODY_LOADED_ACTION:
|
||||
// Dialog's ready; initialize its state.
|
||||
tablet.emitScriptEvent(JSON.stringify({
|
||||
type: EVENT_BRIDGE_TYPE,
|
||||
action: ENABLE_RECORDING_ACTION,
|
||||
value: isRecordingEnabled
|
||||
}));
|
||||
tablet.emitScriptEvent(JSON.stringify({
|
||||
type: EVENT_BRIDGE_TYPE,
|
||||
action: USING_TOOLBAR_ACTION,
|
||||
value: isUsingToolbar()
|
||||
}));
|
||||
tablet.emitScriptEvent(JSON.stringify({
|
||||
type: EVENT_BRIDGE_TYPE,
|
||||
action: NUMBER_OF_PLAYERS_ACTION,
|
||||
value: Player.numberOfPlayers()
|
||||
}));
|
||||
break;
|
||||
case ENABLE_RECORDING_ACTION:
|
||||
// User update "enable recording" checkbox.
|
||||
// The recording state must be idle because the dialog is open.
|
||||
isRecordingEnabled = message.value;
|
||||
updateButtonState();
|
||||
break;
|
||||
case STOP_PLAYING_RECORDING_ACTION:
|
||||
// Stop the specified player.
|
||||
Player.stopPlayingRecording(message.value);
|
||||
|
@ -503,35 +469,26 @@
|
|||
|
||||
function onTabletScreenChanged(type, url) {
|
||||
// Open/close dialog in tablet or window.
|
||||
var RECORD_URL = "/scripts/system/html/record.html",
|
||||
HOME_URL = "Tablet.qml";
|
||||
var RECORD_URL = "/scripts/system/html/record.html";
|
||||
|
||||
if (type === "Home" && url === HOME_URL) {
|
||||
// Start countdown if using toolbar and recording is enabled.
|
||||
if (isUsingToolbar() && isRecordingEnabled && Recorder.isIdle()) {
|
||||
Recorder.startCountdown();
|
||||
}
|
||||
isDialogDisplayed = false;
|
||||
} else if (type === "Web" && url.slice(-RECORD_URL.length) === RECORD_URL) {
|
||||
if (type === "Web" && url.slice(-RECORD_URL.length) === RECORD_URL) {
|
||||
// Cancel countdown or finish recording.
|
||||
if (Recorder.isCountingDown()) {
|
||||
Recorder.cancelCountdown();
|
||||
} else if (Recorder.isRecording()) {
|
||||
Recorder.finishRecording();
|
||||
}
|
||||
isDialogDisplayed = true;
|
||||
} else {
|
||||
isDialogDisplayed = false;
|
||||
}
|
||||
button.editProperties({ isActive: isDialogDisplayed });
|
||||
}
|
||||
|
||||
function onTabletShownChanged() {
|
||||
// Open/close tablet.
|
||||
isDialogDisplayed = false;
|
||||
|
||||
if (!tablet.tabletShown) {
|
||||
// Start countdown if recording is enabled.
|
||||
if (isRecordingEnabled && Recorder.isIdle()) {
|
||||
Recorder.startCountdown();
|
||||
}
|
||||
} else {
|
||||
if (tablet.tabletShown) {
|
||||
// Cancel countdown or finish recording.
|
||||
if (Recorder.isCountingDown()) {
|
||||
Recorder.cancelCountdown();
|
||||
|
|
Loading…
Reference in a new issue