Understanding H5P Content Types and Libraries

H5P is a wonderful thing. The educational world has been ‘all a buzz’ about H5P since its release. What H5P does is put the authoring of various interactive content pieces in the reach of more casual users. Such interactive content previously involved additional, multiple and generally complex software.

H5P is quite simple to use (particular by comparison to other available options), is open source and much lower cost (usually free) than the other available options.

But wait, there’s more. H5P can also be used within common environments such as WordPress, including PressBooks and Commons in a Box based servers (via plugin) and Moodle and other LMSs (via core integration or plugin) just to mention a few options that are popular at TRU and OpenETC.

Content Types

The magic of H5P occurs through its Content Types. Here’s an excerpt of the H5P Content/Add New interface:

There are two items circled in red above that I want to make note of because they hint at the deeper issues that we will discuss below. The first of the two circles indicates that there is an update for the Quiz content type, or in other words that there is a new version. We’ll look more at versions below. We can also infer that the Content Types are somehow separate from one another and from H5P itself in some way. We’ll also discuss this below.

This “somehow separate-ness” is further hinted at by the the second red circle in the diagram above. We can see that we already have some of the available content types in our site, but we do not yet have the Column type, but it can be obtained separately. This is also the case for several other content types that aren’t included in the above screen capture.

And more…libraries

Oh how I wish I could stop here, but I know you want the whole story. Modern programming is typically done on a modular basis for a number of great reasons:

  • accordance with a concept known as “separation of concerns”. In other words, a programmer or team will write a small bit of code that will do a specific thing and do it well;
  • this results in several chunks, let’s call them packages for now, that each do something. If I want my thing, in addition to its primary purpose, to do a good job of a thing that someone has already written a package for, I can include their package (if it is open source) along with my thing;
  • this in turn means that my package depends on another package, referred to as a dependency.

In H5P packages are called libraries (another popular term). Content Types are themselves a type of library. However, most Content Types also have dependencies which are either other, usually simpler, Content Types or are other libraries.

Versions

Modern programming is also (usually) iterative. The maintainer of a package (Content Type or Library) will generally revisit what they have written.

They may fix some bugs that have shown up once their package is in use, or they might have improved the programming, or they might have added new features. When they have a chunk of such additional activity ready to go they will release (used as a verb here, but also used as a noun e.g. “a new release”) a new version.

Successive versions are almost always kept track of by a numbering system, and sometimes a name. Libraries (including Content Types) in H5P are kept track of using a numbering system called Semantic Versioning, or SemVer for short, for example: 2.13.6

These are not normal decimal numbers, they are three sets of numbers separated by two periods. There is whole big long deal about this numbering system that I’ll spare you (there will be a link soon that you can go to if you are having trouble sleeping), but it is important to know what each number represents.

In order, from left to right:

  • The first number indicates a major version. When this number is increased it indicates that some of the new things might cause some of the old things to break (break is a harsh word for things that may have changed from what your are used to, or are done a different way). Usually there are release notes somewhere to tell you what these things might be and how to deal with them.
  • The second number indicates a minor version. Increases to this number indicate that there is new stuff, but it is done in a “backward compatible way” that shouldn’t break anything.
  • The third number indicates a patch which is usually designed to fix bugs. https://semver.org/ (If you are feeling that I’m not bending your brain enough feel free to follow the preceding link, but I wouldn’t if I were you.)

Why are you doing this to us?

Well, if you use H5P exclusively in a single environment (just Moodle or just WordPress) you can likely get away without knowing this stuff. However, a popular H5P development workflow (and a very efficient one) is to develop H5P content in one environment (usually because it’s easier and faster) and then move it to another environment for delivery.

An H5P content object is developed in the context of:

  • a particular version of H5P
  • a particular version of the Content Type (library)
  • (a) particular version(s) of the dependencies of the Content Type (other Content Types and libraries)

and when these versions are not compatible (usually newer on the source system than the target) between the source environment and the target environment there can be import difficulties. This is usually indicated by an obtuse error message or messages and a stubborn refusal of H5P to import the content into the target environment.

On rare occasions I will hear of such difficulties from end users, but more commonly these issues get to me from the LTIG support team, especially when they are running workshops. The intent of this post is to help ameliorate such difficulties. Also, this background information is important for the next bit of H5P we will look at.

A cool new utility

While we are talking about developing on one environment and moving to another I would like to tip my hat to one of my LTIG colleagues, Brenna Clarke Gray, who discovered a new utility called Lumi. https://next.lumi.education/

Lumi is a desktop app that lets you author H5P content objects locally on your computer rather than browser-based environments such as WordPress, Moodle and other LMSs. Much faster and you don’t need to be online. Very slick.

Library Maintenance

The good news is the majority of what follows in Moodle or other LMSs is taken care of by server administrators and similarly permissioned folk. The bad news is that in a WordPress Multisite environment, including Trubox, OpenETC, Pressbooks, and Commons in a Box sites, if you have a website, then you are the site admin and have to do much of this tending yourself.

The elements of this post so far come together in the H5P Content/Libraries screen. Before looking at this screen let’s remember the following about versions and dependencies:

  • H5P itself is versioned software and all elements of the lower bullet in this list have the H5P version as a dependency,
  • An H5P Content Object has a specific version of a Content Type as a dependency along with the specific versions of the Content Type’s dependencies (other Content Types and libraries).

Now for some good news. Usually you just need to tend to the version of the Content Types you are actually using in authoring and the Content Type will handle the updates of its dependencies. The exception is when you have manually uploaded a library or a content type that is not one of H5P’s stock ones. We’ll look at a manual library addition further down.

The Libraries Window

This is found (in WordPress) on the site’s admin panel in the H5P Content/Libraries menu item. The upper portion of the screen looks like this:

Okay, the first section, the Content Type Cache, has a fairly good explanation. Hitting the Update button simply lets your site know about any new versions of things, but it does not update those things, it just updates the list in the lower part of the screen.

The second item, which you will seldom use, is an interface for manually uploading libraries. We’ll look at an instance where you might use it, depending on your academic discipline.

Okay, let’s get a better view of the lower part and talk about what it tells us.

Okay, this screen gives us a pile of information starting with the column numbered 1. This lists the installed Content Types and Libraries and their version numbers. Note that there are sometimes multiple versions of these listed (pair 8 & 9 and pair 10 & 11). This occurs when different Content Objects have different versions of a Content Type as their dependency, and also when a new version of a Content Type is installed but not yet used by any Content Objects. Also note that items 8 & 9 are different versions of a content type, while 10 & 11 are different versions of a dependent library that was installed by one or more content types.

The column labelled 3 (label 2 seems to be lost, email it to me if you find it) is the restricted column for some items. I have so far been unsuccessful in finding a satisfactory explanation for this, what it restricts and for whom, but I would imagine it makes something unavailable for someone. My advice, leave it alone.

Columns labelled 4, 5, & 6 show how many things are using the item as a dependency. So row 8, for instance, shows 1 authored content object using it as a Content Type (column 4), 1 Content Type (I have a sneaking suspicion this includes self-referent dependency) using it as a dependency (column 5) and one other library using it as a dependency (column 6). In row 9 we see the newer Content Type version of row 8, but because the Content Object has not been updated against it only the additional library is showing as depending on it.

We see 2 or 3 Action buttons per library item in the column labelled 7. Content Types have the extra “up arrow in a circle” button which lets you update all of the Content Objects using the version of the Content Type to a newer version. In this case, pressing that button will update a single Content Object from the Content Type in row 8 to the one in row 9 and the dependency columns 4, 5, & 6 will be updated accordingly.

Warning: if you update your content objects against newer versions of Content Types/libraries give them a thorough going over to make sure that they have not been altered from what you intended. This is why this stuff doesn’t update automatically. Or if it is working just fine leave it alone.

The next button in the column labelled 7 gives you more information about the library including, if it is a Content Type, a list of Content Objects using the Content Type (and version) as a dependency.

The third button is a delete button which will only be available if the item has no items of any kind depending on it.

How to upload a library

On our way to fixing errors let’s look at uploading a library. This came up about a week or two ago. It seems that there is a library that, when uploaded, will allow you to include mathematical expressions via the latex language in H5P text fields. https://h5p.org/mathematical-expressions. All we need to do is download the library and then upload it to our site using the library manual upload interface.

The download link (and usage instructions) are on the web page I linked in the previous paragraph. So with the file downloaded to my computer, I upload it via the interface and voila.

So what about the errors when I move my content?

This almost always only happens when your authoring environment uses a newer version of a Content Type/Library than the target environment. If the target environment is an LMS then you will need to get your wise and friendly system administrator to update it. If you are moving things to a WordPress site that you are the site administrator of then you will need to update it yourself.

So, before doing anything else, go to the library window and update the Content Type Cache. This will let your site know about all the latest versions of the Content Types.

Note the content type that you used for authoring your content object. Use the H5P Content/add new item menu command to open the dialog in the very first screen capture at the top of this article in the Content Types section.

If the required Content Type has a Get button, press it to update to the latest version.

If the required Content Type instead has a Details button, check for an Update Available link next to the name of the Content Item and press it if one is there.

The import should now work. If not, then contact your server admin who may need to update the H5P version.

If it still doesn’t work seek some technical support, something is amiss.

Wow, you really buried the lead in this article…why?

Well, because this is a university and I believe that “How” should be accompanied by the 5 Ws. Also I believe that the better you understand your tools the easier your life will be.

Cheers

Similar Posts

Leave a Reply