mirror of
https://github.com/overte-org/overte.git
synced 2025-08-07 05:37:13 +02:00
Make and save recording
This commit is contained in:
parent
bae04966f9
commit
3de1c0a312
3 changed files with 25 additions and 17 deletions
|
@ -8,9 +8,17 @@
|
||||||
|
|
||||||
#include "RecordingScriptingInterface.h"
|
#include "RecordingScriptingInterface.h"
|
||||||
|
|
||||||
|
#include <QStandardPaths>
|
||||||
#include <QtCore/QThread>
|
#include <QtCore/QThread>
|
||||||
|
#include <QtCore/QUrl>
|
||||||
|
#include <QtScript/QScriptValue>
|
||||||
|
#include <QtWidgets/QFileDialog>
|
||||||
|
|
||||||
|
#include <AssetClient.h>
|
||||||
|
#include <AssetUpload.h>
|
||||||
|
#include <BuildInfo.h>
|
||||||
#include <NumericalConstants.h>
|
#include <NumericalConstants.h>
|
||||||
|
#include <PathUtils.h>
|
||||||
#include <Transform.h>
|
#include <Transform.h>
|
||||||
#include <recording/Deck.h>
|
#include <recording/Deck.h>
|
||||||
#include <recording/Recorder.h>
|
#include <recording/Recorder.h>
|
||||||
|
@ -18,13 +26,6 @@
|
||||||
#include <recording/Frame.h>
|
#include <recording/Frame.h>
|
||||||
#include <recording/ClipCache.h>
|
#include <recording/ClipCache.h>
|
||||||
|
|
||||||
|
|
||||||
#include <QtScript/QScriptValue>
|
|
||||||
#include <AssetClient.h>
|
|
||||||
#include <AssetUpload.h>
|
|
||||||
#include <QtCore/QUrl>
|
|
||||||
#include <QtWidgets/QFileDialog>
|
|
||||||
|
|
||||||
#include "ScriptEngineLogging.h"
|
#include "ScriptEngineLogging.h"
|
||||||
|
|
||||||
using namespace recording;
|
using namespace recording;
|
||||||
|
@ -188,6 +189,14 @@ void RecordingScriptingInterface::stopRecording() {
|
||||||
_lastClip->seek(0);
|
_lastClip->seek(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString RecordingScriptingInterface::getDefaultRecordingSaveDirectory() {
|
||||||
|
QString directory = PathUtils::getAppLocalDataPath() + "Avatar Recordings/";
|
||||||
|
if (!QDir(directory).exists()) {
|
||||||
|
QDir().mkdir(directory);
|
||||||
|
}
|
||||||
|
return directory;
|
||||||
|
}
|
||||||
|
|
||||||
void RecordingScriptingInterface::saveRecording(const QString& filename) {
|
void RecordingScriptingInterface::saveRecording(const QString& filename) {
|
||||||
if (QThread::currentThread() != thread()) {
|
if (QThread::currentThread() != thread()) {
|
||||||
QMetaObject::invokeMethod(this, "saveRecording", Qt::BlockingQueuedConnection,
|
QMetaObject::invokeMethod(this, "saveRecording", Qt::BlockingQueuedConnection,
|
||||||
|
|
|
@ -65,6 +65,7 @@ public slots:
|
||||||
|
|
||||||
float recorderElapsed() const;
|
float recorderElapsed() const;
|
||||||
|
|
||||||
|
QString getDefaultRecordingSaveDirectory();
|
||||||
void saveRecording(const QString& filename);
|
void saveRecording(const QString& filename);
|
||||||
bool saveRecordingToAsset(QScriptValue getClipAtpUrl);
|
bool saveRecordingToAsset(QScriptValue getClipAtpUrl);
|
||||||
void loadLastRecording();
|
void loadLastRecording();
|
||||||
|
|
|
@ -136,9 +136,7 @@
|
||||||
log("Start recording");
|
log("Start recording");
|
||||||
Script.setTimeout(function () {
|
Script.setTimeout(function () {
|
||||||
// Delay start so that start beep is not included in recorded sound.
|
// Delay start so that start beep is not included in recorded sound.
|
||||||
|
Recording.startRecording();
|
||||||
// TODO
|
|
||||||
|
|
||||||
RecordingIndicator.show();
|
RecordingIndicator.show();
|
||||||
}, START_RECORDING_SOUND_DURATION);
|
}, START_RECORDING_SOUND_DURATION);
|
||||||
recordingState = RECORDING;
|
recordingState = RECORDING;
|
||||||
|
@ -155,21 +153,21 @@
|
||||||
if (recordingState === COUNTING_DOWN) {
|
if (recordingState === COUNTING_DOWN) {
|
||||||
Script.clearInterval(countdownTimer);
|
Script.clearInterval(countdownTimer);
|
||||||
} else {
|
} else {
|
||||||
|
Recording.stopRecording();
|
||||||
// TODO
|
|
||||||
|
|
||||||
RecordingIndicator.hide();
|
RecordingIndicator.hide();
|
||||||
}
|
}
|
||||||
recordingState = IDLE;
|
recordingState = IDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
function finishRecording() {
|
function finishRecording() {
|
||||||
log("Finish recording");
|
|
||||||
playSound(finishRecordingSound);
|
playSound(finishRecordingSound);
|
||||||
|
Recording.stopRecording();
|
||||||
// TODO
|
|
||||||
|
|
||||||
RecordingIndicator.hide();
|
RecordingIndicator.hide();
|
||||||
|
var filename = (new Date()).toISOString(); // yyyy-mm-ddThh:mm:ss.sssZ
|
||||||
|
filename = filename.replace(/[\-:]|\.\d*Z$/g, "").replace("T", "-") + ".hfr"; // yyyymmmdd-hhmmss.hfr
|
||||||
|
filename = Recording.getDefaultRecordingSaveDirectory() + filename;
|
||||||
|
log("Finish recording: " + filename);
|
||||||
|
Recording.saveRecording(filename);
|
||||||
recordingState = IDLE;
|
recordingState = IDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue