address code review comments

This commit is contained in:
Stephen Birarda 2017-04-14 11:53:11 -07:00
parent 1b24538756
commit 7b48feca66
9 changed files with 20 additions and 7 deletions

View file

@ -10,6 +10,7 @@
#include "ClipCache.h"
#include "impl/PointerClip.h"
#include "Logging.h"
using namespace recording;
NetworkClipLoader::NetworkClipLoader(const QUrl& url) :
@ -45,7 +46,7 @@ NetworkClipLoaderPointer ClipCache::getClipLoader(const QUrl& url) {
}
QSharedPointer<Resource> ClipCache::createResource(const QUrl& url, const QSharedPointer<Resource>& fallback, const void* extra) {
qDebug() << "Loading recording at" << url;
qCDebug(recordingLog) << "Loading recording at" << url;
return QSharedPointer<Resource>(new NetworkClipLoader(url), &Resource::deleter);
}

View file

@ -61,7 +61,8 @@ void RecordingScriptingInterface::loadRecording(const QString& url, QScriptValue
auto weakClipLoader = clipLoader.toWeakRef();
// when clip loaded, call the callback with the URL and success boolean
connect(clipLoader.data(), &recording::NetworkClipLoader::clipLoaded, this, [this, weakClipLoader, url, callback]() mutable {
connect(clipLoader.data(), &recording::NetworkClipLoader::clipLoaded, this,
[this, weakClipLoader, url, callback]() mutable {
if (auto clipLoader = weakClipLoader.toStrongRef()) {
qCDebug(scriptengine) << "Loaded recording from" << url;

View file

@ -31,7 +31,6 @@ public:
void setScriptEngine(QScriptEngine* scriptEngine) { _scriptEngine = scriptEngine; }
public slots:
void loadRecording(const QString& url, QScriptValue callback = QScriptValue());
void startPlaying();

View file

@ -23,6 +23,8 @@ Agent.isAvatar = true;
Recording.loadRecording(recordingFile, function(success) {
if (success) {
Script.update.connect(update);
} else {
print("Failed to load recording from " + recordingFile);
}
});

View file

@ -47,6 +47,8 @@ var playRecording = function() {
Recording.startPlaying();
isPlaying = true;
isPlayable = false; // Set this true again after the cooldown period
} else {
print("Failed to load recording from " + CLIP_URL);
}
});
};

View file

@ -10,9 +10,13 @@ Agent.isAvatar = true;
Script.setTimeout(function () {
Avatar.position = origin;
Recording.loadRecording("d:/hifi.rec", function(success){
Recording.setPlayerLoop(true);
Recording.startPlaying();
Recording.loadRecording("d:/hifi.rec", function(success) {
if (success) {
Recording.setPlayerLoop(true);
Recording.startPlaying();
} else {
print("Failed to load recording");
}
});
}, millisecondsToWaitBeforeStarting);

View file

@ -60,6 +60,8 @@ function update(deltaTime) {
Recording.setPlayerUseHeadModel(false);
Recording.setPlayerUseSkeletonModel(useAvatarModel);
Agent.isAvatar = true;
} else {
print("Failed to load recording from " + clip_url);
}
});
}

View file

@ -49,7 +49,7 @@ function getAction(channel, message, senderID) {
case SHOW:
print("Show");
Recording.loadRecording(clip_url, function(success){
Recording.loadRecording(clip_url, function(success) {
if (success) {
Agent.isAvatar = true;
Recording.setPlayerTime(0.0);

View file

@ -284,6 +284,8 @@ function mousePressEvent(event) {
Recording.loadRecording(recordingFile, function(success) {
if (success) {
setDefaultPlayerOptions();
} else {
print("Failed to load recording from " + recordingFile);
}
});
}