Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How can I use API.LMSCommit(”); to check LMS connection?

Participant ,
May 15, 2016 May 15, 2016

Hi all,

I want to find a way to use an API.LMSCommit('') call to let my modules check to see that they are still connected to the LMS.

If it is a false boolean then it calls myAlert function to pop up a message to tell the learner they need to reconnect.

Is this the right way to do this? or is there a way to do this already in Captivate 8?

var checked = API.LMSCommit()

if (checked == true){

//do nothing;}

if(checked == false){

import flash.external.ExternalInterface;

ExternalInterface.call("myAlert");

}

Cheers

Luke

2.4K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 15, 2016 May 15, 2016

Further to the above,

I did find a function in the scormdriver.js that comes with 8 and I figured that already has a call to commit.

So I am trying this in AS3

import flash.external.ExternalInterface;

var checked = ExternalInterface.call.("SCORM_CallLMSCommit")

if(checked == "SCORM_FALSE"){

ExternalInterface.call("myAlert");

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
May 16, 2016 May 16, 2016

First question, even if you alert that is not connected, how is the learner going to reconnect?

The SCORM_CallLMSCommit will actually return "false" as that is the default value of SCORM_FALSE. Plus the function returns either true or false as a Boolean.

So you could just say:

import flash.external.ExternalInterface;

var checked:Boolean = ExternalInterface.call.("SCORM_CallLMSCommit")

if( !checked ){

ExternalInterface.call("myAlert");

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 16, 2016 May 16, 2016

Thanks TLC,

I have added a function that changes the users browser and throws up a warning (blinking) to tell the learner that they need to log in again to complete the learning.

Thanks for the above code, I'll try it out and see what happens

Luke

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 16, 2016 May 16, 2016

I have tried this with some tracking components either side

var checked:Boolean = ExternalInterface.call.("SCORM_CallLMSCommit")

Unfortunately it looks as though this call is breaking. Either I'm not calling the right function in the scormdrive.js or the LMS is not responding to the call.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 16, 2016 May 16, 2016

I believe the ExternalInterface.call is not getting any further than the captivate stage. As that is where I have myAlert in JavaScript. Is there a way to get the call beyond the player something like parent.parent.? I have tried that btw and it just shows up as an ActionScript error.

Before you ask I am trying to make this moduler like a widget for non programmers in our team to drag and drop on to their captivate stage.

Cheers.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
May 17, 2016 May 17, 2016

The function should be there. The actual scorm spirit could be in the parent.

Not on a computer right now, but you could actually just check the value of the spirit variable. Look for a function like getApi or something like that. The result is put into a variable. The value of the variable should be API for scorm 1.2

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 17, 2016 May 17, 2016

If I didn't know you were a great programmer I would have said you were a poet "The actual scorm spirit " Indeed! but I think I get the gist. I will look into it in the morning.

Thanks TLC.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
May 17, 2016 May 17, 2016

The variable is SCORM_objAPI, which should have a value of API.

The function to get the API is SCORM_GrabAPI();

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 17, 2016 May 17, 2016

OK so I am now trying this in JavaScript back in Cptv8 inside a "Time Based Action Widget"

API = SCORM_GrabAPI();

if(API == null){

cpAPIInterface.setVariableValue("SCO_NO",1);

myAlert();

}

So far no result out of localhost I will try:

API = SCORM_GrabAPI();

if(API != null){

cpAPIInterface.setVariableValue("SCO_NO",1);

myAlert();

}

After loading this to scormcloud.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 17, 2016 May 17, 2016

So far so good, It would seem that on an LMS the SCORM_GrabAPI(); is finding the API and returning an not null. But I don't know if that is just it finding the function.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 17, 2016 May 17, 2016

So overnight I will try this and see what I get in the morning.

myVar = setInterval(APIChecker,60000);

APIChecker();

function APIChecker(){

API = SCORM_GrabAPI();

if(API != null){

myAlert_happy();

}

else {

myAlert();

}

}

myAlert_happy makes the browser window a greenish color

myAlert makes it a red.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 18, 2016 May 18, 2016

Curious, the SCORM_GrabAPI(); function returns a value of [object Object].

What does that mean?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 18, 2016 May 18, 2016

So with that I'll try this:

myVar = setInterval(APIChecker,1200000);

APIChecker();

function APIChecker(){

API = SCORM_GrabAPI();

if(API == "[object Object]"){

myAlert_happy();

cpAPIInterface.setVariableValue("SCO_NO",API);

}

else {

myAlert();

}

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 18, 2016 May 18, 2016
LATEST

So this next, based on what I found in the scormdriver.js

var myVar = setInterval(APIChecker,1200000);

APIChecker();

function APIChecker(){

API = SCORM_GrabAPI();

if (API.LMSCommit()!=null)

{

myAlert_happy();

cpAPIInterface.setVariableValue("FOO","back at ya");

}

else {

myAlert();

cpAPIInterface.setVariableValue("FOO","Lost connection");

}

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Help resources