It is possible for H5Ps to end up requiring multiple versions of the same library. The code that builds the list of dependencies only keys off of machine name, and thus will only include one version of a library.
This only seems to impact the mobile app because the web experience is not dependent on the export file to load the dependencies. However the mobile app will throw dependency errors trying to open the same H5P. However, I have noticed that sometimes, if you view another H5P that includes the missing dependency, and then view the broken H5P, it will start working. It would seem that the mobile app has some capacity to cache dependencies and make them available between modules.
This is my post on the H5P forum about the issue:
Steps to reproduce
- Create an mod_h5pactivity instance using the attached `broken.h5p` file
- Open the mobile app try to view the app
- You should see the attached error screenshot.
One note on testing: Because it seems that the mobile app can cache dependencies from one module to another, you'll need to delete your local cache for the mobile app. The easiest way to do this is to log out and remove the site, and add it back again.
What I think is happening
This H5P was created on h5p.com and is a CoursePresentation v1.22.0. This depends on both H5PEditor.ColorSelector v1.2 and H5P.Shape v1.0. It comes bundled with H5P.Shape v1.0.0, which depends on H5PEditor.ColorSelector v1.2. However, the latest version of H5P.Shape is v1.0.4 and depends on H5PEditor.ColorSelector v1.3.
I believe at some point the cron task updated H5P.Shape on our server and that is when we started experiencing this issue.
I determined this by comparing the export file that my local server sent to the mobile app to the h5p I uploaded to the server. I attached a copy of that export file to this issue.
Simply make the dependency list key off machine name AND version. I changed these 3 lines in my local version, forced the exports to regenerate, and then the bug went away:
I was forcing the export files to regenerate by deleting the their matching row from the files table, but I would recommend just deleting the module instance and re-creating it.