Closed haithamrdina closed 2 years ago
Hi @haithamrdina,
I assume you know how to receive cmi data from iframe, submit through ajax to API. I will share some code below for your reference.
1) First of all, you need to have retrieve the sco ID and sco tracking ID. (I assume you have it)
2) Submit cmi data with sco ID and sco tracking ID.
3) Use the code below to find user sco tracking.
$scoTracking = ScormManager::findScoTrackingId($scoUuid, $scoTrackingUuid);
4) Update user learning with the following code:
$sco = ScormManager::updateScoTracking($scoUuid, $scoTracking->user_id, $this->request->input('cmiData'));
if ($sco->lesson_status == 'completed' || $sco->lesson_status == 'passed') {
// Any function that you want to execute as soon as user is completed the scorm.
// It could be send a congratulation email, update user learning result, generate certificate and etc
}
thanks you so much @devianl2 if u can share with me some reference to receive cmi data from iframe,
@haithamrdina You may refer to SCORM Run-Time Reference.
Btw, you can also refer to src/Manager/ScormManager.php (Starting from line 421)
Some sample:
$scoreRaw = isset($data['cmi.core.score.raw']) ? intval($data['cmi.core.score.raw']) : null; $scoreMin = isset($data['cmi.core.score.min']) ? intval($data['cmi.core.score.min']) : null; $scoreMax = isset($data['cmi.core.score.max']) ? intval($data['cmi.core.score.max']) : null; $lessonStatus = isset($data['cmi.core.lesson_status']) ? $data['cmi.core.lesson_status'] : 'unknown'; $sessionTime = isset($data['cmi.core.session_time']) ? $data['cmi.core.session_time'] : null;
how to receive cmi data(lesson_location) from iframe for every current lesson?
how to receive cmi data(lesson_location) from iframe for every current lesson?
You can use some javascript library to capture CMI data and use postMessage to transmit the data between laravel application and frontend iframe
postMessage: https://javascript.info/cross-window-communication#postmessage
SCORM library sample: https://www.npmjs.com/package/scorm-again
Do you have an example how to play the scorm after upload. So far Im already success on upload part. But after that, no idea how to show, play and track progress.
Do you have an example how to play the scorm after upload. So far Im already success on upload part. But after that, no idea how to show, play and track progress.
Hi @zaks-zaiya , 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.
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 :)
hi [@devianl2 there are no examples for saving progress ? if you can make an example to see how do it thanks