How does resuming an exercise work in H5P?

There are many small exercises that can be created with H5P. It’s not really necessary to be able to pause and resume them later. One can complete them in one go. However, there are some content types that allow to create exercises which can require quite some time to complete. I am thinking of Interactive Books with lots of information and many exercises, for instance. If I am taking all the exercises, it would be nice if my answers were stored and retrieved when I visit the exercises later on.

On top of that, there are some content types that do not really make sense if everything that one entered and did is lost once one leaves the page, e.g. when using Cornell Notes, the repetition mode of Dialogcards or – depending on the use case – the Documentation Tool.

The core of H5P allows to pause and to resume later. It is often called “save content state”, because that’s what it does. In order to work, the respective H5P Integration (aka plugin) will need to implement some functions to save the state inside the database, in the file system or whatever the H5P integration might use to store data. And the other way around, the integration needs to load the previous state to restore it.

Works, but that’s theory. In practice, there are quite some things that one might need to know and there’s no documentation on h5p.org. Let’s see if this post can fill the void. But beware, reading everything might take some time …

What content types support this feature?

That question implies that not all H5P content types support this feature. And not all do. For some, it doesn’t really make sense to store a state. What should Chart store? Would it really be relevant for Image Juxtaposition to put the handle to the exact same position that it had when the user last visited?

That said: Most content types that could benefit from this feature support it. I don’t want to maintain a list that needs to be updated manually all the time if things change, so you will not find one here. H5P Group has a list, but it will only list content types that are available on the H5P Hub, and I don’t know how frequently it will be updated. There’s also a draft of an “H5P Registry” repository that contains a resume field telling you whether this feature is supported or not. It will allow to determine whether a content type supports that feature or not – even programatically – but when writing these lines, all the fields were set to false. Maybe that has changed now?

What does H5P store? And where?

Content types will store any information that they deem necessary to re-create the state when resuming. This could cover what options were clicked in Multiple Choice or the number of attempts left for listening to an audio sample sentence in Dictation. It could also be personal information though if you think of a Freetext Question (part of Interactive Video) or Essay.

Sometimes, the content type will not store and re-create all information that the user may wanted to have. For instance, if you have answered a Multiple Choice question and clicked on the “Check” button, then the content type would remember the answers that were given – but not that the “Check” button was clicked. When you resume, your answers will still be chosen, but you will not see the results. It is as if you left before clicking on “Check”.

As mentioned before, H5P will store the state data on the platform that you are running H5P on. That could be inside the database (what plugins usually do) or the file system. Some H5P integrations may, however, relay the information to cloud services such as AWS from Amazon. That’s not something that H5P does, but your host and you should question the respective authorities if you have questions or want to know where your data goes.

When and in what cases does H5P store the state?

In order to make H5P store the state, some requirements will have to be met:

  • The “Save content state” feature must be activated for the H5P integration.
  • The content type that is used must support the resume feature.
  • The user running the content must be logged into the platform such as WordPress or moodle.

If you can check these items, then certain events can lead H5P core to save the state.

Regular intervals

The core of H5P will try to save the state in regular intervals. Those intervals can usually be set by an administrator in the H5P integrations’ options. The default settings often is 30 seconds. That means that every 30 seconds the state should be saved.

You may find that interval too large, and one can set it smaller. However, each storing attempt will sent a request from the browser to the server. If the server is not well powered, it may not be able to handle the requests, especially if multiple people are using H5P at the same time. You better do not set the value too small. One cannot say what “too small” is without knowing the server specifications and the use case scenario.

Particular xAPI events

H5P supports something that is called xAPI. It’s a standardized way of communicating what a user experienced. In particular, it is used for transferring the results of H5P contents. Those pieces of xAPI data are associated with a verb that expresses what a user did, e.g. the verb might be “completed” when he/she completed something or “progressed” if she/he progressed within the exercise in some way.

Those two verbs are exactly what H5P core is waiting for. When it detects xAPI data that use “completed” or “progressed”, then it will wait for three seconds and then save the state. H5P would for instance store the state three seconds after

  • the user answered all the questions put into a Column (“completed”) or
  • the user move from one slide of a Course Presentation to another (“progressed”).

A common verb that is used and should also trigger saving is “answered”. It is usually used when a user clicks on the “Check” button. Unfortunately, H5P does not react to “answered” so far.

Particular browser events

Browsers can dispatch so called “events” when certain things happen, For instance, there are:

  • beforeunload: Dispatched when a document is about to be unloaded.
  • unload: Dispatched when a document is unloaded, so for instance when you close a tab.
  • pagehide: Dispatched when the current page is hidden, for instance when you click on the browser’s back button.

H5P will try to save the state whenever it encounters one of these events. However, all these events are somewhat unreliable or may not work the same on every browser.

How can I active the “resume” feature?

The headline of this section already hints to the fact that the “resume” feature is not activated by default. You – or an administrator if you do not have the required permissions – will need to make sure that the “save content state” option is checked in the respective H5P Integration.

H5P plugin for WordPress

The settings can be changed in the Settings→H5P menu of the H5P plugin for WordPress.
Excerpt from the WordPress options for H5P. Showing the "Save Content State" section with a checkbox to toggle "Allow logged-in users to resume tasks" on and off and a numerical input field for the "Auto-save frequency in seconds" set to 30 seconds)
You can toggle the resume feature on and off, and you can define the auto-save interval in seconds.

H5P plugin for Drupal 7/8/9

The settings can be can be changed in the Configuration→H5P menu of the H5P module for Drupal.
Excerpt from the Drupal options for H5P. Showing the "Save Content State" section with a checkbox to toggle "Save content state" on and off and a numerical input field for the "Save content state frequency"

You can toggle the resume feature on and off, and you can define the auto-save interval in seconds.

H5P plugin for moodle

The settings can be changed in the menu of the H5P plugin for moodle under Site Administration → Plugins / Activity modules / H5P / H5P Settings.

Excerpt from the moodle's options for H5P. Showing the "Save Content State" section with a checkbox to toggle "Save content state" on and off (Default: No) and a numerical input field for the "Save content state frequency"

You can toggle the resume feature on and off, and you can define the auto-save interval in seconds.

moodle’s custom H5P integration in moodle core

When writing these lines, moodle’s custom H5P Integration (not to be confused with the H5P plugin for moodle) unfortunately does not support resuming the state of H5P content – but it is in review according to this tracker ticket. Chances are that it will be available as of moodle 4.2.

Lumi

The desktop version of Lumi does not support resuming. The cloud based version does allow resuming. By default it uses a 5 seconds interval. You cannot turn the feature off, and you cannot change the auto-save interval.

H5P.com

H5P.com offers a little more granularity than the other H5P integrations. It is only available to those who have the drill-down reports included in their license and included the content in some learning management system via LTI.

If you go to Manage organization →Settings, then within the LTI section, you will find the setting to activate the resume feature. It has more granular options than the other H5P integrations.
Excerpt from the H5P.com options for H5P. Showing the "LTI Settings" section with a dropdown menu labelled "Allow logged-in users to resume content" and the options "Always", "Never", "Controlled by the author - on by default" and "Controlled by the author - off by default"

The option “Always” is the same as toggling the feature on in other H5P integrations, and the option “Never” is the same as toggling the feature off. One can, however, also leave the decision to the content author. She/he can decide if resuming should be possible or not individually for each content. That is what the two “Controlled by author” options are meant for. The “on by default” variant leaves the feature on by default, the “off by default” variant leaves the feature off be default. Duh.

There is no option for setting the interval, however. H5P.com seems to determine that itself, possibly depending on the current server load. I have checked the value that was specified a couple of times and yielded values between 24 and 48 seconds.

If the administrator allowed authors to change the setting, the authors will find a checkbox underneath the content editor within the LTI Settings section.

Excerpt from the H5P.com options for H5P. Showing the "LTI Settings" section underneath H5P content. It shows a checkbox labelled "Allow logged-in users to resume content".

ILIAS, Stud.IP, TYPO3, …

Don’t know what these respective plugins support.

What common issues and problems are there?

There are some common issues that one may encounter with saving the state.

The feature is always turned on or off for all contents

Unfortunately, except for H5P.com, no H5P Integration allows to turn the resume feature on or off individually. It is always on or off for all contents. That can be troublesome if some author of a platform wants to allow resuming while others do not.

The H5P integrations for WordPress, moodle, Drupal, etc. would need to be changed a little in order to allow the same granularity that H5P.com offers.

The state doesn’t get saved in time

The aforementioned mechanisms that H5P uses to determine whether it should save or not leave some room for improvement. They do not always run in time, and then the state is not saved.

One improvement would be to also store the state three seconds after an xAPI statement with the verb “answered” was emitted. That would normally happen whenever a user answered a question. Another event to listen for might be the visibilitychange event that fires when the document contents become invisible, e.g. when the user changes to a different tab.

There already is a pull request that suggests to add just that.

The state gets reset when the author changes something, even if she/he is just fixing a typo

When an author edits H5P content that a user has already been working on, then all states that were saved in connection with this content will be reset. Unfortunately, this happens for any change, even if only a typo is fixed.

The idea behind this probably is that the exercise was changed and that the answers that were given may not be valid anymore. So H5P resets the state, and the users will need to answer everything all over again. That’s not always the desired behavior, of course. A solution could be to add an option to the editor of H5P content that allows authors to choose whether the state needs to be reset or not.

Another reason could be that the structure of the content’s parameters changed and it might not match with the structure of the state anymore. This is not bad necessarily, it could work and and many cases would. But to be sure, it might require the core of H5P or the respective content type to detect that divergence and act accordingly – extra code would be needed.

The states cannot be reset manually (per user)

There’s some odd behavior in many H5P content types. When the user has achieved full score, the retry button does not show. When now the state is saved, and the user returns later on, he/she will still have been awarded full score, see the results and have no way to retry the exercise.

There’s no good workaround here (besides changing the state inside the database). An author could edit and save the content. That would reset the state and the user could retry the exercise, but at the same time, the state of every other user would also be reset.

In order to change this, the H5P integrations should be given an option to reset the state of some H5P content for certain users only. In fact, H5P.com is about to receive a button that users can click on to reset a task completely.

Timers are not correct

Some H5P content types such as Memory Game keep track of the time that the user spends and display the elapsed time. If those content types supported the resume feature, the time that is shown when the user restart will not be correct. That’s due to the interval saving nature and the unreliability of the browser events that need to be used.

There’s probably no satisfying solution for this problem.

The feature does not work if you are embedding content using the embed code

No further text 🙂