mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 00:50:35 +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;
|
||||
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
|
||||
function update(event) {
|
||||
|
@ -179,5 +185,3 @@ function update(event) {
|
|||
Script.update.disconnect(update);
|
||||
}
|
||||
}
|
||||
|
||||
Script.update.connect(update);
|
||||
|
|
|
@ -20,7 +20,11 @@ Avatar.orientation = Quat.fromPitchYawRollDegrees(0, 0, 0);
|
|||
Avatar.scale = 1.0;
|
||||
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
|
||||
function update(event) {
|
||||
|
@ -44,5 +48,3 @@ function update(event) {
|
|||
Script.update.disconnect(update);
|
||||
}
|
||||
}
|
||||
|
||||
Script.update.connect(update);
|
||||
|
|
|
@ -42,10 +42,13 @@ var playRecording = function() {
|
|||
Recording.setPlayerLoop(false);
|
||||
Recording.setPlayerTime(STARTING_TIME);
|
||||
Recording.setPlayerAudioOffset(AUDIO_OFFSET);
|
||||
Recording.loadRecording(CLIP_URL);
|
||||
Recording.startPlaying();
|
||||
isPlaying = true;
|
||||
isPlayable = false; // Set this true again after the cooldown period
|
||||
Recording.loadRecording(CLIP_URL, function(success) {
|
||||
if (success) {
|
||||
Recording.startPlaying();
|
||||
isPlaying = true;
|
||||
isPlayable = false; // Set this true again after the cooldown period
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Script.update.connect(function(deltaTime) {
|
||||
|
|
|
@ -10,9 +10,11 @@ Agent.isAvatar = true;
|
|||
|
||||
Script.setTimeout(function () {
|
||||
Avatar.position = origin;
|
||||
Recording.loadRecording("d:/hifi.rec");
|
||||
Recording.setPlayerLoop(true);
|
||||
Recording.startPlaying();
|
||||
Recording.loadRecording("d:/hifi.rec", function(success){
|
||||
Recording.setPlayerLoop(true);
|
||||
Recording.startPlaying();
|
||||
});
|
||||
|
||||
}, millisecondsToWaitBeforeStarting);
|
||||
|
||||
|
||||
|
|
|
@ -52,13 +52,16 @@ function update(deltaTime) {
|
|||
if (!subscribed) {
|
||||
Messages.subscribe(PLAYBACK_CHANNEL);
|
||||
subscribed = true;
|
||||
Recording.loadRecording(clip_url);
|
||||
Recording.setPlayFromCurrentLocation(playFromCurrentLocation);
|
||||
Recording.setPlayerUseDisplayName(useDisplayName);
|
||||
Recording.setPlayerUseAttachments(useAttachments);
|
||||
Recording.setPlayerUseHeadModel(false);
|
||||
Recording.setPlayerUseSkeletonModel(useAvatarModel);
|
||||
Agent.isAvatar = true;
|
||||
Recording.loadRecording(clip_url, function(success) {
|
||||
if (success) {
|
||||
Recording.setPlayFromCurrentLocation(playFromCurrentLocation);
|
||||
Recording.setPlayerUseDisplayName(useDisplayName);
|
||||
Recording.setPlayerUseAttachments(useAttachments);
|
||||
Recording.setPlayerUseHeadModel(false);
|
||||
Recording.setPlayerUseSkeletonModel(useAvatarModel);
|
||||
Agent.isAvatar = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -49,11 +49,15 @@ function getAction(channel, message, senderID) {
|
|||
|
||||
case SHOW:
|
||||
print("Show");
|
||||
Recording.loadRecording(clip_url);
|
||||
Agent.isAvatar = true;
|
||||
Recording.setPlayerTime(0.0);
|
||||
Recording.startPlaying();
|
||||
Recording.stopPlaying();
|
||||
Recording.loadRecording(clip_url, function(success){
|
||||
if (success) {
|
||||
Agent.isAvatar = true;
|
||||
Recording.setPlayerTime(0.0);
|
||||
Recording.startPlaying();
|
||||
Recording.stopPlaying();
|
||||
}
|
||||
});
|
||||
|
||||
break;
|
||||
|
||||
case HIDE:
|
||||
|
|
|
@ -281,8 +281,11 @@ function mousePressEvent(event) {
|
|||
if (!Recording.isRecording() && !Recording.isPlaying()) {
|
||||
recordingFile = Window.browse("Load recording from file", ".", "Recordings (*.hfr *.rec *.HFR *.REC)");
|
||||
if (!(recordingFile === "null" || recordingFile === null || recordingFile === "")) {
|
||||
Recording.loadRecording(recordingFile);
|
||||
setDefaultPlayerOptions();
|
||||
Recording.loadRecording(recordingFile, function(success) {
|
||||
if (success) {
|
||||
setDefaultPlayerOptions();
|
||||
}
|
||||
});
|
||||
}
|
||||
if (Recording.playerLength() > 0) {
|
||||
toolBar.setAlpha(ALPHA_ON, playIcon);
|
||||
|
|
Loading…
Reference in a new issue