From 6bdd498ecfca598f73fbb2c0a23e331eabf5940e Mon Sep 17 00:00:00 2001 From: David Rowe Date: Tue, 16 May 2017 10:47:52 +1200 Subject: [PATCH] Cancel autoplay when manually playing --- scripts/system/playRecordingAC.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/system/playRecordingAC.js b/scripts/system/playRecordingAC.js index c1c70587c6..f62451154b 100644 --- a/scripts/system/playRecordingAC.js +++ b/scripts/system/playRecordingAC.js @@ -286,6 +286,11 @@ function play(user, recording, position, orientation) { var errorMessage; + if (autoPlayTimer) { // Cancel autoplay. + Script.clearTimeout(autoPlayTimer); + autoPlayTimer = null; + } + userID = user; if (Entity.create(recording, position, orientation)) { @@ -297,6 +302,8 @@ errorMessage = "Could not persist recording " + recording.slice(4); // Remove leading "atp:". log(errorMessage); error(errorMessage); + + autoPlayTimer = Script.setTimeout(autoPlay, AUTOPLAY_ERROR_INTERVAL); // Resume autoplay later. } }