mirror of
https://github.com/JulianGro/overte.git
synced 2025-08-04 02:24:50 +02:00
Make avatar recording and upload to asset server
This commit is contained in:
parent
5676364aec
commit
23c937e55d
1 changed files with 39 additions and 1 deletions
|
@ -29,6 +29,8 @@
|
||||||
USING_TOOLBAR_ACTION = "usingToolbar",
|
USING_TOOLBAR_ACTION = "usingToolbar",
|
||||||
ENABLE_RECORDING_ACTION = "enableRecording",
|
ENABLE_RECORDING_ACTION = "enableRecording",
|
||||||
|
|
||||||
|
mappingPath,
|
||||||
|
|
||||||
CountdownTimer;
|
CountdownTimer;
|
||||||
|
|
||||||
CountdownTimer = (function () {
|
CountdownTimer = (function () {
|
||||||
|
@ -145,7 +147,6 @@
|
||||||
};
|
};
|
||||||
}());
|
}());
|
||||||
|
|
||||||
|
|
||||||
function usingToolbar() {
|
function usingToolbar() {
|
||||||
return ((HMD.active && Settings.getValue("hmdTabletBecomesToolbar"))
|
return ((HMD.active && Settings.getValue("hmdTabletBecomesToolbar"))
|
||||||
|| (!HMD.active && Settings.getValue("desktopTabletBecomesToolbar")));
|
|| (!HMD.active && Settings.getValue("desktopTabletBecomesToolbar")));
|
||||||
|
@ -155,19 +156,56 @@
|
||||||
button.editProperties({ isActive: isRecordingEnabled || recordingState !== IDLE });
|
button.editProperties({ isActive: isRecordingEnabled || recordingState !== IDLE });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setMappingCallback() {
|
||||||
|
var error;
|
||||||
|
|
||||||
|
if (true || Assets.isKnownMapping(mappingPath)) { // TODO: isKnownMapping() is not available in JavaScript.
|
||||||
|
print(APP_NAME + ": Recording mapped to " + mappingPath);
|
||||||
|
print(APP_NAME + ": Request play recording");
|
||||||
|
// TODO
|
||||||
|
} else {
|
||||||
|
error = "Error mapping recording to " + mappingPath + " on Asset Server!";
|
||||||
|
print(APP_NAME + ": " + error);
|
||||||
|
Window.alert(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function saveRecordingToAssetCallback(url) {
|
||||||
|
var filename,
|
||||||
|
hash;
|
||||||
|
|
||||||
|
print(APP_NAME + ": Recording saved to Asset Server as " + url);
|
||||||
|
|
||||||
|
filename = (new Date()).toISOString(); // yyyy-mm-ddThh:mm:ss.sssZ
|
||||||
|
filename = filename.replace(/[-:]|\.\d*Z$/g, "").replace("T", "-") + ".hfr"; // yyyymmmdd-hhmmss.hfr
|
||||||
|
hash = url.slice(4); // Remove leading "atp:" from url.
|
||||||
|
mappingPath = "/recordings/" + filename;
|
||||||
|
Assets.setMapping(mappingPath, hash, setMappingCallback);
|
||||||
|
}
|
||||||
|
|
||||||
function startRecording() {
|
function startRecording() {
|
||||||
recordingState = RECORDING;
|
recordingState = RECORDING;
|
||||||
updateButtonState();
|
updateButtonState();
|
||||||
print(APP_NAME + ": Start recording");
|
print(APP_NAME + ": Start recording");
|
||||||
|
Recording.startRecording();
|
||||||
}
|
}
|
||||||
|
|
||||||
function finishRecording() {
|
function finishRecording() {
|
||||||
|
var error;
|
||||||
|
|
||||||
recordingState = IDLE;
|
recordingState = IDLE;
|
||||||
updateButtonState();
|
updateButtonState();
|
||||||
print(APP_NAME + ": Finish recording");
|
print(APP_NAME + ": Finish recording");
|
||||||
|
Recording.stopRecording();
|
||||||
|
if (!Recording.saveRecordingToAsset(saveRecordingToAssetCallback)) {
|
||||||
|
error = "Could not save recording to Asset Server!";
|
||||||
|
print(APP_NAME + ": " + error);
|
||||||
|
Window.alert(error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function cancelRecording() {
|
function cancelRecording() {
|
||||||
|
Recording.stopRecording();
|
||||||
recordingState = IDLE;
|
recordingState = IDLE;
|
||||||
updateButtonState();
|
updateButtonState();
|
||||||
print(APP_NAME + ": Cancel recording");
|
print(APP_NAME + ": Cancel recording");
|
||||||
|
|
Loading…
Reference in a new issue