Using h5p content types in a Moodle Lesson

I'm running Moodle with the latest h5p plugin installed and I can successfully create h5p content in my course without needing to embed iframe code that links the user to the h5p site.  However, what I really need to do is create h5p content within a Moodle lesson activity.  It seems I can only create "local" h5p content if it sits at the course level (i.e. a list of h5p content types at the same level as the rest of the course activities).  I cannot find a way to insert my installed h5p content type into a lesson.  Anyone out there figured out how to do this or is it not set up to work that way?

allow installed h5p content type to be used in Moodle Lesson
tomaj's picture


Embedding H5Ps in lessons is currently not implemented, but we (the developers) are aware that he community wants this feature very much.

The only hack that I am aware of, is to create the content here on, and use the embed feature here, to get an iframe that can be embedded in Moodle.

- Tom

Thanks for the reply Tom.  Unfortunately that doesn't get us where we want to go.  We're already using the embed/iframe option but it doesn't allow us any control over the style sheets.  We need to customize the h5p elements so they match our branding, as well as changing things we don't think look as good as they could (usually spacing issues).  We'll be looking forward to the new feature.  Keep me posted!  Thanks.

tomaj's picture


Actually, there are php hooks in H5P, for getting the css into the iframes. And this is the recommended way of styling H5P. The documentation for how to do this is found here.

And here is a Github repo with example code of how to do it.

- Tom

I'm new to H5p and still testing to see if it will work for us.  On the way I found a workaround for this.Here goes:

  1. Create your content as an activity in the same course as the lesson.
  2. Copy the embed code and paste it onto the appropriate page of the lesson.
  3. Hide the content activity from students.

I've tested this in our own Moodle with a quiz and it seems to work fine.  Not sure it's a long term proposition but at least its a workaround until someone with more skill can make a programming fix! :)

BV52's picture

Hi phippsy,

Thank you for sharing this. You are correct we now have the embed code in Moodle which was release late last year.


I tried the solution but it didn't seem to work. I used the generated code <script src="http://[myurl]/mod/hvp/library/js/h5p-resizer.js" type="text/javascript"></script> and inserted it via the html source editor. My moodle version is 3.4 and I have already installed the H5P plugin in the moodle. It did work outside the lessons module.

BV52's picture

Hi zahiruddin,

What are you seeing when you follow the steps above? Can you please attach a screenshot.


trhp's picture

Hi there,

I'm using Moodle lessons a lot, and very often embedding h5p content on one or more content pages in the lesson as part of the leeeosn flow. However I need to be able to see my students results in moodle's gradebook (as do the students themselves) - also the results from the embedded h5p-content in the lesson.

Is this possible?


BV52's picture

Hi trhp,

I'm afraid this is not possible since the H5P activity will not generate xAPI statements when embedded.


trhp's picture

Thanks, BV52 :) - no problem.

I'll be looking forward to your new 'branching scenarios' which I guess will be a lot like moodle lessons.




it is possible to embed an h5p-activity into text and get it tracked in the gradings. You have to create the h5p-activity and set its visiblity to "Make available but not shown on course page". Then you copy the embed code and use it in any textfield you like.

Because of the fact, that the iframe loads the very same h5p-activity, that is part of the course, gradings will be stored.

The drawback of this is, that when you import the content to another course, or make a backup and restore it, then the link of the embed-code has to be changed. Otherwise it will link to the "old" activity and gradings would be stored in the "old" course.

A possible better solution would be the use of moodle-filters. Moodle automatically links activities that are mentionned in a text, if the title of the activity matches.

It would be perfect it one could write a moodle filter plugin that looks for h5p-activities by name (e.g. {{h5p:My quiz xyz}}), additionally such a filter could control the behaviour (link or embed) like  {{h5p:My quiz xyz:link}} vs. {{h5p:My quiz xyz:embed}}.



inspired this topic I wrote a small moodle plugin that allows the embedding of h5p-content by the pattern {h5p~name of the activity}. It is available on github ( For the moodle plugins database it has to pass the review before it is published on Once it is accepted it will be available at

Kind regards


BV52's picture

Hi rschrenk,

Thank you for your contribution, the community will benefit a lot from this.