mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 10:47:11 +02:00
Update to use modified Recording API
This commit is contained in:
parent
2731c13a5c
commit
e7fb268843
1 changed files with 29 additions and 21 deletions
|
@ -21,6 +21,7 @@
|
||||||
HEARTBEAT_INTERVAL = 3000, // TODO: Final value.
|
HEARTBEAT_INTERVAL = 3000, // TODO: Final value.
|
||||||
TIMESTAMP_UPDATE_INTERVAL = 2500, // TODO: Final value.
|
TIMESTAMP_UPDATE_INTERVAL = 2500, // TODO: Final value.
|
||||||
AUTOPLAY_SEARCH_INTERVAL = 5000, // TODO: Final value.
|
AUTOPLAY_SEARCH_INTERVAL = 5000, // TODO: Final value.
|
||||||
|
AUTOPLAY_ERROR_INTERVAL = 30000, // 30s
|
||||||
scriptUUID,
|
scriptUUID,
|
||||||
|
|
||||||
Entity,
|
Entity,
|
||||||
|
@ -262,24 +263,9 @@
|
||||||
// Recording playback functions.
|
// Recording playback functions.
|
||||||
var isPlayingRecording = false,
|
var isPlayingRecording = false,
|
||||||
recordingFilename = "",
|
recordingFilename = "",
|
||||||
autoPlayTimer = null;
|
autoPlayTimer = null,
|
||||||
|
|
||||||
function playRecording(recording, position, orientation) {
|
playRecording;
|
||||||
Agent.isAvatar = true;
|
|
||||||
Avatar.position = position;
|
|
||||||
Avatar.orientation = orientation;
|
|
||||||
|
|
||||||
Recording.loadRecording(recording);
|
|
||||||
Recording.setPlayFromCurrentLocation(true);
|
|
||||||
Recording.setPlayerUseDisplayName(true);
|
|
||||||
Recording.setPlayerUseHeadModel(false);
|
|
||||||
Recording.setPlayerUseAttachments(true);
|
|
||||||
Recording.setPlayerLoop(true);
|
|
||||||
Recording.setPlayerUseSkeletonModel(true);
|
|
||||||
|
|
||||||
Recording.setPlayerTime(0.0);
|
|
||||||
Recording.startPlaying();
|
|
||||||
}
|
|
||||||
|
|
||||||
function play(recording, position, orientation) {
|
function play(recording, position, orientation) {
|
||||||
if (Entity.create(recording, position, orientation)) {
|
if (Entity.create(recording, position, orientation)) {
|
||||||
|
@ -297,17 +283,39 @@
|
||||||
|
|
||||||
recording = Entity.find();
|
recording = Entity.find();
|
||||||
if (recording) {
|
if (recording) {
|
||||||
isPlayingRecording = true;
|
|
||||||
recordingFilename = recording.recording;
|
|
||||||
|
|
||||||
log("Play persisted recording " + recordingFilename);
|
log("Play persisted recording " + recordingFilename);
|
||||||
|
|
||||||
playRecording(recording.recording, recording.position, recording.orientation);
|
playRecording(recording.recording, recording.position, recording.orientation);
|
||||||
} else {
|
} else {
|
||||||
autoPlayTimer = Script.setTimeout(autoPlay, AUTOPLAY_SEARCH_INTERVAL); // Try again soon.
|
autoPlayTimer = Script.setTimeout(autoPlay, AUTOPLAY_SEARCH_INTERVAL); // Try again soon.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
playRecording = function (recording, position, orientation) {
|
||||||
|
Recording.loadRecording(recording, function (success) {
|
||||||
|
if (success) {
|
||||||
|
Agent.isAvatar = true;
|
||||||
|
Avatar.position = position;
|
||||||
|
Avatar.orientation = orientation;
|
||||||
|
|
||||||
|
Recording.setPlayFromCurrentLocation(true);
|
||||||
|
Recording.setPlayerUseDisplayName(true);
|
||||||
|
Recording.setPlayerUseHeadModel(false);
|
||||||
|
Recording.setPlayerUseAttachments(true);
|
||||||
|
Recording.setPlayerLoop(true);
|
||||||
|
Recording.setPlayerUseSkeletonModel(true);
|
||||||
|
|
||||||
|
isPlayingRecording = true;
|
||||||
|
recordingFilename = recording;
|
||||||
|
|
||||||
|
Recording.setPlayerTime(0.0);
|
||||||
|
Recording.startPlaying();
|
||||||
|
} else {
|
||||||
|
log("Failed to load recording " + recording);
|
||||||
|
autoPlayTimer = Script.setTimeout(autoPlay, AUTOPLAY_ERROR_INTERVAL); // Try again later.
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
function stop() {
|
function stop() {
|
||||||
log("Stop playing " + recordingFilename);
|
log("Stop playing " + recordingFilename);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue