fix PlayRecordingOnAC.js to use new API

This commit is contained in:
Brad Hefta-Gaub 2015-12-02 09:51:52 -08:00
parent fd05bd23a0
commit b6398a7930

View file

@ -10,20 +10,17 @@
// //
var filename = "http://your.recording.url"; var recordingFile = "http://your.recording.url";
var playFromCurrentLocation = true; var playFromCurrentLocation = true;
var loop = true; var loop = true;
Avatar.skeletonModelURL = "https://hifi-public.s3.amazonaws.com/marketplace/contents/e21c0b95-e502-4d15-8c41-ea2fc40f1125/3585ddf674869a67d31d5964f7b52de1.fst?1427169998";
// Set position here if playFromCurrentLocation is true // Set position here if playFromCurrentLocation is true
Avatar.position = { x:1, y: 1, z: 1 }; Avatar.position = { x:1, y: 1, z: 1 };
Avatar.orientation = Quat.fromPitchYawRollDegrees(0, 0, 0); Avatar.orientation = Quat.fromPitchYawRollDegrees(0, 0, 0);
Avatar.scale = 1.0; Avatar.scale = 1.0;
Agent.isAvatar = true; Agent.isAvatar = true;
Avatar.loadRecording(filename); Recording.loadRecording(recordingFile);
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) {
@ -32,22 +29,18 @@ function update(event) {
return; return;
} }
if (count == 0) { if (count == 0) {
Avatar.setPlayFromCurrentLocation(playFromCurrentLocation); Recording.setPlayFromCurrentLocation(playFromCurrentLocation);
Avatar.setPlayerLoop(loop); Recording.setPlayerLoop(loop);
Avatar.setPlayerUseDisplayName(true); Recording.setPlayerUseDisplayName(true);
Avatar.setPlayerUseAttachments(true); Recording.setPlayerUseAttachments(true);
Avatar.setPlayerUseHeadModel(false); Recording.setPlayerUseHeadModel(false);
Avatar.setPlayerUseSkeletonModel(true); Recording.setPlayerUseSkeletonModel(true);
Avatar.startPlaying(); Recording.startPlaying();
Avatar.play();
Vec3.print("Playing from ", Avatar.position); Vec3.print("Playing from ", Avatar.position);
count--; count--;
} }
if (Avatar.isPlaying()) { if (!Recording.isPlaying()) {
Avatar.play();
} else {
Script.update.disconnect(update); Script.update.disconnect(update);
} }
} }