scormtin-can-apilmsxapi

How to instantly inform completion status of iFramed xApi content to parent LMS?


I am trying to show xApi AU (assignable unit) content using HTML iFrame in our portal (custom LMS - Learning Management System). HTML Iframe would pass LRS (Learning Record Store) parameters like below to launch AU which is working.

<URL to AU> ?endpoint=<URL to LMS Listener> &fetch=<Fetch URL for the Authorization Token> &actor=<Actor> &registration=<Registration ID> &activityId=<AU activity ID>

I am trying to figure out how to know that user has finished viewing content (preferably using JavaScript) so parent page knows user has finished AU and can be redirected back to List page. I would like list page to show Completed status for that viewed contents.

In the past (SCORM days), we have added button on top of iframed content "I have completed, Take me back" or similar but users just click that and mark content completed without actually completing.

Is querying LRS constantly the only option possibly?

Thanks


Solution

  • From an xAPI standards perspective, you're correct that for an arbitrary AU/piece of course content, there's no built-in mechanism for to intercept the traffic between the user's browser and the LRS, so there's no direct way to identify if a "completion" statement has been sent. There's a couple common solutions to this problem:

    1. Make an LRS proxy that sits between the user and the actual LRS, intercepts the statements watching for completions and then passes them on to the actual LRS. This is how the cmi5 test suite (Catapult) works. You can have this thing also have a websocket that your parent iframe keeps open and receives messages when these completions come through.

    2. Poll the LRS frequently for the type of statement you're looking for.

    3. If you've constrained your configuration to only specific browsers you can strongly control, you can require the users to install browser extensions that can listen to all network traffic and potentially do updates within the scope of the other frame (or combine with the other techniques above).