devianl2 / laravel-scorm

Laravel scorm package
MIT License
38 stars 20 forks source link

Basic example of uploaded scorm to iframe and tracking user data #20

Closed MeesPos closed 2 years ago

MeesPos commented 2 years ago

Does anyone have an example to put the uploaded course in an iframe, and track the user data?

devianl2 commented 2 years ago

Hi @MeesPos , that is beyond the scope of this package. But to answer your question, you need to know how to use iframe and postMessage to transmit the CMI message into API.

You need to have understand the hierarchy of iframes: https://scorm.com/scorm-explained/technical-scorm/run-time/ Use postMessage to parse your uploaded scorm file url and learner data into children iframe: https://javascript.info/cross-window-communication#postmessage Use frontend scorm library to parse and listen to scorm data, and use postMessage to parse scorm respond back to parent iframe: https://www.npmjs.com/package/scorm-again Any respond that is being captured by parent iframe postMessage listener will send to your POST request API (From your laravel route) This package is mainly focus on SCORM file upload, extract, create SCO data and learner data. It does not cover frontend listener :)

If you need help on frontend iframe listener, please contact me personally (devianleong@gmail.com). I will create a simple demo for you. Just buy me a coffee :)

MeesPos commented 2 years ago

I fixed it, thanks!

haithamrdina commented 2 years ago

@MeesPos hi , you can share the part of code please