问题
After successfully launching our xAPI based LMS I now have a requirement to launch any package at the point where the user last viewed it.
So for example if the package contains 20 slides, we have already recorded the id of each slide opened and that they are 50% of the way through, but how can I use this information to open the package at this point?
thanks
回答1:
Generally with xAPI you would use the State API document resource to capture any ephemeral data of this nature (a bookmark). A State API document is stored based on an actor, activity, and registration along with a profile ID that you coin yourself. The content of the document can be anything, though there is a small amount of special handling for JSON objects. For your case I would store a "bookmark" profile with a JSON object as the content with a property of slide
or similar with a value of the slide number. Then when the content is launched you can retrieve the State document. In the case of a 404 (or unrecognized or invalid data) you can assume it is the first launch and start them at the beginning, otherwise you should have a slide number and automatically jump them to that point.
The original Tin Can Prototypes golf example has a sample of how to achieve this, see: https://github.com/RusticiSoftware/TinCan_Prototypes/blob/master/GolfExample_TCAPI/index.html#L48
Summary of the document APIs: https://xapi.com/blog/deep-dive-document/ More about State API: https://xapi.com/blog/deep-dive-state-activity/
来源:https://stackoverflow.com/questions/62752731/open-xapi-package-at-the-point-where-the-user-left-off