mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 19:29:47 +02:00
modify scripts to use new recording API
This commit is contained in:
parent
c7a28a527a
commit
1b24538756
7 changed files with 80 additions and 59 deletions
|
@ -138,7 +138,13 @@ Agent.isAvatar = true;
|
||||||
Agent.isListeningToAudioStream = true;
|
Agent.isListeningToAudioStream = true;
|
||||||
Avatar.skeletonModelURL = AVATAR_URL; // FIXME - currently setting an avatar while playing a recording doesn't work it will be ignored
|
Avatar.skeletonModelURL = AVATAR_URL; // FIXME - currently setting an avatar while playing a recording doesn't work it will be ignored
|
||||||
|
|
||||||
Recording.loadRecording(RECORDING_URL);
|
Recording.loadRecording(RECORDING_URL, function(success) {
|
||||||
|
if (success) {
|
||||||
|
Script.update.connect(update);
|
||||||
|
} else {
|
||||||
|
print("Failed to load recording from " + RECORDING_URL);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
count = 300; // This is necessary to wait for the audio mixer to connect
|
count = 300; // This is necessary to wait for the audio mixer to connect
|
||||||
function update(event) {
|
function update(event) {
|
||||||
|
@ -179,5 +185,3 @@ function update(event) {
|
||||||
Script.update.disconnect(update);
|
Script.update.disconnect(update);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Script.update.connect(update);
|
|
||||||
|
|
|
@ -20,7 +20,11 @@ Avatar.orientation = Quat.fromPitchYawRollDegrees(0, 0, 0);
|
||||||
Avatar.scale = 1.0;
|
Avatar.scale = 1.0;
|
||||||
Agent.isAvatar = true;
|
Agent.isAvatar = true;
|
||||||
|
|
||||||
Recording.loadRecording(recordingFile);
|
Recording.loadRecording(recordingFile, function(success) {
|
||||||
|
if (success) {
|
||||||
|
Script.update.connect(update);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
count = 300; // This is necessary to wait for the audio mixer to connect
|
count = 300; // This is necessary to wait for the audio mixer to connect
|
||||||
function update(event) {
|
function update(event) {
|
||||||
|
@ -44,5 +48,3 @@ function update(event) {
|
||||||
Script.update.disconnect(update);
|
Script.update.disconnect(update);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Script.update.connect(update);
|
|
||||||
|
|
|
@ -42,10 +42,13 @@ var playRecording = function() {
|
||||||
Recording.setPlayerLoop(false);
|
Recording.setPlayerLoop(false);
|
||||||
Recording.setPlayerTime(STARTING_TIME);
|
Recording.setPlayerTime(STARTING_TIME);
|
||||||
Recording.setPlayerAudioOffset(AUDIO_OFFSET);
|
Recording.setPlayerAudioOffset(AUDIO_OFFSET);
|
||||||
Recording.loadRecording(CLIP_URL);
|
Recording.loadRecording(CLIP_URL, function(success) {
|
||||||
|
if (success) {
|
||||||
Recording.startPlaying();
|
Recording.startPlaying();
|
||||||
isPlaying = true;
|
isPlaying = true;
|
||||||
isPlayable = false; // Set this true again after the cooldown period
|
isPlayable = false; // Set this true again after the cooldown period
|
||||||
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
Script.update.connect(function(deltaTime) {
|
Script.update.connect(function(deltaTime) {
|
||||||
|
|
|
@ -10,9 +10,11 @@ Agent.isAvatar = true;
|
||||||
|
|
||||||
Script.setTimeout(function () {
|
Script.setTimeout(function () {
|
||||||
Avatar.position = origin;
|
Avatar.position = origin;
|
||||||
Recording.loadRecording("d:/hifi.rec");
|
Recording.loadRecording("d:/hifi.rec", function(success){
|
||||||
Recording.setPlayerLoop(true);
|
Recording.setPlayerLoop(true);
|
||||||
Recording.startPlaying();
|
Recording.startPlaying();
|
||||||
|
});
|
||||||
|
|
||||||
}, millisecondsToWaitBeforeStarting);
|
}, millisecondsToWaitBeforeStarting);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,8 @@ function update(deltaTime) {
|
||||||
if (!subscribed) {
|
if (!subscribed) {
|
||||||
Messages.subscribe(PLAYBACK_CHANNEL);
|
Messages.subscribe(PLAYBACK_CHANNEL);
|
||||||
subscribed = true;
|
subscribed = true;
|
||||||
Recording.loadRecording(clip_url);
|
Recording.loadRecording(clip_url, function(success) {
|
||||||
|
if (success) {
|
||||||
Recording.setPlayFromCurrentLocation(playFromCurrentLocation);
|
Recording.setPlayFromCurrentLocation(playFromCurrentLocation);
|
||||||
Recording.setPlayerUseDisplayName(useDisplayName);
|
Recording.setPlayerUseDisplayName(useDisplayName);
|
||||||
Recording.setPlayerUseAttachments(useAttachments);
|
Recording.setPlayerUseAttachments(useAttachments);
|
||||||
|
@ -60,6 +61,8 @@ function update(deltaTime) {
|
||||||
Recording.setPlayerUseSkeletonModel(useAvatarModel);
|
Recording.setPlayerUseSkeletonModel(useAvatarModel);
|
||||||
Agent.isAvatar = true;
|
Agent.isAvatar = true;
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,11 +49,15 @@ function getAction(channel, message, senderID) {
|
||||||
|
|
||||||
case SHOW:
|
case SHOW:
|
||||||
print("Show");
|
print("Show");
|
||||||
Recording.loadRecording(clip_url);
|
Recording.loadRecording(clip_url, function(success){
|
||||||
|
if (success) {
|
||||||
Agent.isAvatar = true;
|
Agent.isAvatar = true;
|
||||||
Recording.setPlayerTime(0.0);
|
Recording.setPlayerTime(0.0);
|
||||||
Recording.startPlaying();
|
Recording.startPlaying();
|
||||||
Recording.stopPlaying();
|
Recording.stopPlaying();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HIDE:
|
case HIDE:
|
||||||
|
|
|
@ -281,9 +281,12 @@ function mousePressEvent(event) {
|
||||||
if (!Recording.isRecording() && !Recording.isPlaying()) {
|
if (!Recording.isRecording() && !Recording.isPlaying()) {
|
||||||
recordingFile = Window.browse("Load recording from file", ".", "Recordings (*.hfr *.rec *.HFR *.REC)");
|
recordingFile = Window.browse("Load recording from file", ".", "Recordings (*.hfr *.rec *.HFR *.REC)");
|
||||||
if (!(recordingFile === "null" || recordingFile === null || recordingFile === "")) {
|
if (!(recordingFile === "null" || recordingFile === null || recordingFile === "")) {
|
||||||
Recording.loadRecording(recordingFile);
|
Recording.loadRecording(recordingFile, function(success) {
|
||||||
|
if (success) {
|
||||||
setDefaultPlayerOptions();
|
setDefaultPlayerOptions();
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
if (Recording.playerLength() > 0) {
|
if (Recording.playerLength() > 0) {
|
||||||
toolBar.setAlpha(ALPHA_ON, playIcon);
|
toolBar.setAlpha(ALPHA_ON, playIcon);
|
||||||
toolBar.setAlpha(ALPHA_ON, playLoopIcon);
|
toolBar.setAlpha(ALPHA_ON, playLoopIcon);
|
||||||
|
|
Loading…
Reference in a new issue