mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 16:38:27 +02:00
Upload QByteArray
This commit is contained in:
parent
1b18d3656f
commit
1db6d0e3c1
2 changed files with 8 additions and 16 deletions
|
@ -177,8 +177,7 @@ void RecordingScriptingInterface::saveRecording(const QString& filename) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RecordingScriptingInterface::saveRecordingToAsset(QScriptValue getClipAtpUrl) {
|
bool RecordingScriptingInterface::saveRecordingToAsset(QScriptValue getClipAtpUrl) {
|
||||||
|
if (!getClipAtpUrl.isFunction())
|
||||||
if (!getClipAtpUrl.isFunction())
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (QThread::currentThread() != thread()) {
|
if (QThread::currentThread() != thread()) {
|
||||||
|
@ -192,13 +191,14 @@ bool RecordingScriptingInterface::saveRecordingToAsset(QScriptValue getClipAtpUr
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString filename = "./temp.hfr";
|
//QString filename = "./temp.hfr";
|
||||||
recording::Clip::toFile(filename, _lastClip);
|
//recording::Clip::toFile(filename, _lastClip);
|
||||||
|
|
||||||
QUrl url{ filename };
|
//QUrl url{ filename };
|
||||||
|
|
||||||
if (auto upload = DependencyManager::get<AssetClient>()->createUpload(url.toLocalFile())) { // Here we should use the other implementation of createUpload, but we need the QByteArray of the _lastClip
|
|
||||||
|
|
||||||
|
//if (auto upload = DependencyManager::get<AssetClient>()->createUpload(url.toLocalFile())) {
|
||||||
|
|
||||||
|
if (auto upload = DependencyManager::get<AssetClient>()->createUpload(recording::Clip::toBuffer(_lastClip), HFR_EXTENSION)) {
|
||||||
QObject::connect(upload, &AssetUpload::finished, this, [=](AssetUpload* upload, const QString& hash) mutable {
|
QObject::connect(upload, &AssetUpload::finished, this, [=](AssetUpload* upload, const QString& hash) mutable {
|
||||||
auto filename = QFileInfo(upload->getFilename()).fileName();
|
auto filename = QFileInfo(upload->getFilename()).fileName();
|
||||||
QString clip_atp_url = "";
|
QString clip_atp_url = "";
|
||||||
|
@ -215,18 +215,13 @@ bool RecordingScriptingInterface::saveRecordingToAsset(QScriptValue getClipAtpUr
|
||||||
args << clip_atp_url;
|
args << clip_atp_url;
|
||||||
getClipAtpUrl.call(QScriptValue(), args);
|
getClipAtpUrl.call(QScriptValue(), args);
|
||||||
});
|
});
|
||||||
|
|
||||||
// start the upload now
|
|
||||||
upload->start();
|
upload->start();
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void RecordingScriptingInterface::loadLastRecording() {
|
void RecordingScriptingInterface::loadLastRecording() {
|
||||||
if (QThread::currentThread() != thread()) {
|
if (QThread::currentThread() != thread()) {
|
||||||
QMetaObject::invokeMethod(this, "loadLastRecording", Qt::BlockingQueuedConnection);
|
QMetaObject::invokeMethod(this, "loadLastRecording", Qt::BlockingQueuedConnection);
|
||||||
|
|
|
@ -82,9 +82,6 @@ protected:
|
||||||
Flag _useAttachments { false };
|
Flag _useAttachments { false };
|
||||||
Flag _useSkeletonModel { false };
|
Flag _useSkeletonModel { false };
|
||||||
recording::ClipPointer _lastClip;
|
recording::ClipPointer _lastClip;
|
||||||
|
|
||||||
private:
|
|
||||||
void clipUploadFinished(AssetUpload* upload, const QString& hash);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_RecordingScriptingInterface_h
|
#endif // hifi_RecordingScriptingInterface_h
|
||||||
|
|
Loading…
Reference in a new issue