Display playback errors only for user that initiated playback

This commit is contained in:
David Rowe 2017-05-12 15:18:25 +12:00
parent acd71caae2
commit 2bed69cfea
2 changed files with 11 additions and 4 deletions

View file

@ -267,7 +267,8 @@
Player = (function () {
// Recording playback functions.
var isPlayingRecording = false,
var userID = null,
isPlayingRecording = false,
recordingFilename = "",
autoPlayTimer = null,
@ -277,13 +278,16 @@
// Send error message to user.
Messages.sendMessage(HIFI_RECORDER_CHANNEL, JSON.stringify({
command: RECORDER_COMMAND_ERROR,
user: userID,
message: message
}));
}
function play(recording, position, orientation) {
function play(user, recording, position, orientation) {
var errorMessage;
userID = user;
if (Entity.create(recording, position, orientation)) {
log("Play recording " + recording);
isPlayingRecording = true;
@ -305,6 +309,7 @@
recording = Entity.find();
if (recording) {
log("Play persisted recording " + recordingFilename);
userID = null;
playRecording(recording.recording, recording.position, recording.orientation);
} else {
autoPlayTimer = Script.setTimeout(autoPlay, AUTOPLAY_SEARCH_INTERVAL); // Try again soon.
@ -424,7 +429,7 @@
switch (message.command) {
case PLAYER_COMMAND_PLAY:
if (!Player.isPlaying()) {
Player.play(message.recording, message.position, message.orientation);
Player.play(sender, message.recording, message.position, message.orientation);
} else {
log("Didn't start playing " + message.recording + " because already playing " + Player.recording());
}

View file

@ -352,7 +352,9 @@
message = JSON.parse(message);
if (message.command === RECORDER_COMMAND_ERROR) {
error(message.message);
if (message.user === MyAvatar.sessionUUID) {
error(message.message);
}
} else {
index = playerIDs.indexOf(sender);
if (index === -1) {