From 9dd82105bbaf2fc393c1c0e569c91cc21e97b482 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Thu, 9 Dec 2021 13:50:37 +0100 Subject: [PATCH] wait #4949 @2 --- js/libs/scorm/apiwrapper.js | 20 ++++++++++++-------- js/libs/scorm/scorm.js | 4 +++- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/js/libs/scorm/apiwrapper.js b/js/libs/scorm/apiwrapper.js index b7f34e28..c2e02b29 100644 --- a/js/libs/scorm/apiwrapper.js +++ b/js/libs/scorm/apiwrapper.js @@ -219,19 +219,23 @@ pipwerks.SCORM.connection.initialize = function () { errorCode = 0; if (API) { - switch (scorm.version) { - case "1.2" : - success = makeBoolean(API.LMSInitialize("")); - break; - case "2004": - success = makeBoolean(API.Initialize("")); - break; + if (API.Initialized !== true) { + switch (scorm.version) { + case "1.2" : + success = makeBoolean(API.LMSInitialize("")); + break; + case "2004": + success = makeBoolean(API.Initialize("")); + break; + } + } else { + success = true; } if (success) { //Double-check that connection is active and working before returning 'true' boolean errorCode = debug.getCode(); - if (errorCode !== null && errorCode === 0) { + if (API.Initialized===true || (errorCode !== null && errorCode === 0)) { scorm.connection.isActive = true; if (scorm.handleCompletionStatus) { //Automatically set new launches to incomplete diff --git a/js/libs/scorm/scorm.js b/js/libs/scorm/scorm.js index 79065d3c..0944fdae 100644 --- a/js/libs/scorm/scorm.js +++ b/js/libs/scorm/scorm.js @@ -178,7 +178,9 @@ function finishScorm() { } setSessionTime(); pipwerks.SCORM.save(); - pipwerks.SCORM.quit(); + if (fluidbook.settings.multilang === '') { + pipwerks.SCORM.quit(); + } } function scormMarkAsComplete() { -- 2.39.5