gabrieldoty / simplify-scorm

Scorm 1.2 Javascript API
MIT License
230 stars 77 forks source link

scorm Interactions are not getting recorded in window.API.cmi #19

Closed sainag closed 5 years ago

sainag commented 5 years ago

Hi,

I'm able to set the data for student_id etc, however I'm not able get data about scorm interactions in the cmi element.

Can someone help?

xob commented 5 years ago

Is your SCO built for SCORM 1.2? If it's built for SCORM 2004, then you need to look at window.API_1484_11.cmi instead.

If that doesn't work, I suggest turning on debugging and looking at what is going on in the console. It should help you figure out what is going wrong.

sainag commented 5 years ago

I'm using SCORM 1.2. Does this package work outside of LMS? I'm testing this on a web page by pointing to scorm package in an iFrame.

xob commented 5 years ago

Everything should work in an iFrame setup (scorm API on the parent, SCO in the iFrame). Is there some place I could look at your code or maybe even test your setup?

sainag commented 5 years ago

@xob Here is my code in an html page:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Scorm Test</title>
    <script src="https://code.jquery.com/jquery-3.3.1.min.js"
  integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
  crossorigin="anonymous"></script>
<style>
    iframe {
        width: 900px;
        height: 600px;
        position: absolute;
        left:0;
        right: 0;
        top:0;
        bottom: 0;
        margin: auto;
    }
</style>
</head>

<body>
    <iframe src="eLearning/index.html" frameborder="0"></iframe>
    <button onclick="save()">Save</button>

    <script type="text/javascript" src="js/scormAPI.js?2"></script>
    <script>
        $(document).ready(function() {
            window.API.cmi.core.student_id = 10;
        });
        function save() {
            var simplifiedObject = window.API.cmi.toJSON();
            console.log(simplifiedObject);
        }
    </script>
</body>

</html>

I'm only testing the API in this page to use it somewhere else so all I wanted to see is cmi object with all data captured from the SCORM package in the save function.

FYI, SCORM package (eLearning/index.html) is built using iSpring and the version is SCORM 1.2.

Please let me know if I have to do anymore setup to capture the data.

Thanks

xob commented 5 years ago

Please turn on debugging and look at the console to see exactly what your SCO is doing with the API. It should help you figure out what (if anything) is going on. If you don't see anything, then your SCO is not using the API correctly.

window.API.apiLogLevel = 1;
window.API_1484_11.apiLogLevel = 1;

With that, you should be able to see all the calls the SCO is doing to the API.

sainag commented 5 years ago

I turned on debugging but I do not see anything in the console. I think you are right that the SCO is not using API correctly. Do you have a sample SCO that I can download and test with the SCORM API so I can find out what to do with my SCO?

sainag commented 5 years ago

@xob hey I tested it with a different SCO and it's working. Thanks for your help.

erancov commented 4 years ago

Hi! I'm trying to create an angular application where people can upload courses(SCORM). I don't understand how to communicate with that courses, how do i get data, and store in my db. How to create the relation between courses and my application. This need s to be dynamic. Thank you!

!!!I don't want to create courses. I just want to use them.

jackbaron commented 3 years ago

@erancov Have you found a solution yet?

albinagorta commented 2 years ago

alguien encontro una solucion?

CiNguyen commented 1 year ago

Help me! I want to get data of all actions on scorm file