mirror of
https://github.com/overte-org/overte.git
synced 2025-04-15 10:08:46 +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 <QStandardPaths>
|
||||
#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 <PathUtils.h>
|
||||
#include <Transform.h>
|
||||
#include <recording/Deck.h>
|
||||
#include <recording/Recorder.h>
|
||||
|
@ -18,13 +26,6 @@
|
|||
#include <recording/Frame.h>
|
||||
#include <recording/ClipCache.h>
|
||||
|
||||
|
||||
#include <QtScript/QScriptValue>
|
||||
#include <AssetClient.h>
|
||||
#include <AssetUpload.h>
|
||||
#include <QtCore/QUrl>
|
||||
#include <QtWidgets/QFileDialog>
|
||||
|
||||
#include "ScriptEngineLogging.h"
|
||||
|
||||
using namespace recording;
|
||||
|
@ -188,6 +189,14 @@ void RecordingScriptingInterface::stopRecording() {
|
|||
_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) {
|
||||
if (QThread::currentThread() != thread()) {
|
||||
QMetaObject::invokeMethod(this, "saveRecording", Qt::BlockingQueuedConnection,
|
||||
|
|
|
@ -65,6 +65,7 @@ public slots:
|
|||
|
||||
float recorderElapsed() const;
|
||||
|
||||
QString getDefaultRecordingSaveDirectory();
|
||||
void saveRecording(const QString& filename);
|
||||
bool saveRecordingToAsset(QScriptValue getClipAtpUrl);
|
||||
void loadLastRecording();
|
||||
|
|
|
@ -136,9 +136,7 @@
|
|||
log("Start recording");
|
||||
Script.setTimeout(function () {
|
||||
// Delay start so that start beep is not included in recorded sound.
|
||||
|
||||
// TODO
|
||||
|
||||
Recording.startRecording();
|
||||
RecordingIndicator.show();
|
||||
}, START_RECORDING_SOUND_DURATION);
|
||||
recordingState = RECORDING;
|
||||
|
@ -155,21 +153,21 @@
|
|||
if (recordingState === COUNTING_DOWN) {
|
||||
Script.clearInterval(countdownTimer);
|
||||
} else {
|
||||
|
||||
// TODO
|
||||
|
||||
Recording.stopRecording();
|
||||
RecordingIndicator.hide();
|
||||
}
|
||||
recordingState = IDLE;
|
||||
}
|
||||
|
||||
function finishRecording() {
|
||||
log("Finish recording");
|
||||
playSound(finishRecordingSound);
|
||||
|
||||
// TODO
|
||||
|
||||
Recording.stopRecording();
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue