The role of preloadedDependencies property in h5p installation package and in h5p library
The property "preloadedDependencies" occurrs in two files:
- h5p.json file of a .h5p package
- library.json file of a library
These properties have different values. For example for MultiChoice, in library.json the preloadedDependencies is an array of 4 dependencies (EmbeddedJS, H5P.JoubelUI, FontAwesome and H5P.Question) and in json.h5p it is an array of 9 dependencies, including those 4 plus some extra (H5P.Image, H5P.Transition, Drop, Tether and the MultiChoice itself).
On a Drupal site there is a page which lists library usage. I noticed that installing a library like the one above only increments usage for the 4 libraries from library.json and the extra existing in h5p.json remains the same.
The documentation says:
In h5p.json - Libraries that are used by this content type and needs to be preloaded for this content type to work.
In library.json - Libraries that need to be loaded for this library to work.
I can't figure out from the documentation, why are the "preloadedDependencies" values different in both files? Shouldn't they be the same? What is the role of the extra dependencies which are only in h5p.json and don't increment library usage?
icc
Wed, 10/05/2016 - 11:41
Permalink
Your confusion is
Your confusion is understandable. The h5p.json file actually describes the properties of the content while library.json describes the properties of the content type. So, if you export a Multiple Choice task which has a video included as its optional 'media field', the h5p.json file will state that this content needs H5P.Video to be loaded before it can display the content. If you look at the dependencies in library.json for H5P.Multichoice, you'll notice that the task itself does not need H5P.Video in order to function. I.e. the H5P.Video is only needed by the content and is optional for the task to function.
Note that if the package only contains content types(libraries) and no content, there will be no h5p.json file.
I can only hope that this clarified things :-)
bluetea
Wed, 10/05/2016 - 12:30
Permalink
Many thanks!
Many thanks!