Allow save content state to work inside embedded H5P (Moodle)
Submitted by phil.r on Mon, 09/02/2024 - 06:58
Forums:
Currently when turning 'save content state' on in a Moodle site, the H5P activity itself will save the state but any H5P embedded using embed code in another activity/text area does not. Is it possible to implement save content state so that it works when H5Ps have been embedded, or is this a technical limitation?
otacke
Mon, 09/02/2024 - 23:11
Permalink
Storing the state requires a
Storing the state requires a user to be logged in, so the state can clearly be linked to a user to retrieve it for him or her when she or he returns later. And if a user is logged in, then you're on that platform anyway and do not need embedding.
There are a couple of other ways this could be solved or worked around.
You could assign a non-logged in user a random id, but then you'd need to store that ID in the browser's local storage which raises privacy concerns in many places. Also, the server might have to store lots of states for users who may never return, thus wasting a lot of resources and requiring you to have some purging strategy.
You could also store the state in the browser's local storage completely, but that storage is limited and may overflow if too many states need to be stored. Also not something that you may want.
For both approaches, you will need to use the same browser on the same device. If you switch to another browser or device, your old state would not be retrieved.
phil.r
Wed, 09/18/2024 - 06:30
Permalink
Thanks for the reply!While it
Thanks for the reply!
While it's not strictly necessary to use embedding, it's a common choice amongst Moodle administrators to improve the UX. It allows H5Ps to be embedded into any activity type where the text editor is available and allows for a great deal of flexibility in where the content can be used. It would mostly be for cases where the H5P content supplements other information, text and media and therefore needs to be combined with the H5P content.
In any case, it does sound like this isn't an easy thing to implement given the embedded version lies outside the activity page, which would have the logic to save the state based on the save content state time. It would be great to see it as an option at some point down the track if anyone can figure out the optimal way of implementing it!