preloadedDependencies are not installing automatically for custom H5P content type

{
"title": "Video Game",
"description": "Custom video game.",
"majorVersion": 1,
"minorVersion": 0,
"patchVersion": 0,
"runnable": 1,
"author": "Arun AK",
"license": "MIT",
"machineName": "H5P.VideoGame",
"preloadedJs": [
{
"path": "video-game.js"
}
],
"preloadedCss": [
{
"path": "video-game.css"
}
],
"preloadedDependencies": [
{
"machineName": "H5P.Video",
"majorVersion": 1,
"minorVersion": 6
}
],
"editorDependencies": [
{
"machineName": "H5PEditor.Wizard",
"majorVersion": 1,
"minorVersion": 2
}
]
}


When I try to install my custom content type VideoGame.h5p file the editor shows error for missing 'Video' library.

How to configure to install preloadedDependencies automatically when upload a custom H5P library?

otacke's picture

Hi!

If your platform doesn't host the Video library in version 1.6 already, you will need to bundle it with your custom content type. That's what the `-r` option of the H5P CLI tool is for when packing a library. Otherwise, H5P will not install your content type, because it cannot fulfill the dependencies.

Best,
Oliver

It seems some issue with the folder structure.

My project is here ~/PhpstormProjects/h5p/video-game

and I cloned https://github.com/h5p/h5p-video.git inside 'video-game' folder.

Then packed using command h5p pack -r video-game h5p-video vg1.h5p

Attached a screenshot of my folder structure.

Then when upload the package(vg1.h5p) in the editor, getting following error.

Validating h5p package failed.

A valid content folder is missing

A valid main h5p.json file is missing

Attachments: 
otacke's picture

The `h5p-video` folder needs to be in the same folder as your `h5p-video-game? folder, not inside the latter. Just like any other dependency that you may require. One is essentially packing from what would be the `library` folder of an H5P integration.

otacke's picture

Oh, and when you upload that, do NOT upload it on the H5P Hub which is meant for content files, not for plain libraries. The H5P library setting screen is meant for uploading mere libraries.

I am not uploading to H5P Hub. I am trying to upload in to my Drupal 9 website's H5P editor.

I updated the folder structure as mentioned, but still getting same error.

Validating h5p package failed.

A valid content folder is missing

 

A valid main h5p.json file is missing

otacke's picture

What you call H5P Editor is the H5P Hub.

Drupal has an H5P library settings page (Content => H5P Libraries) that is supposed to accept mere library files that do not contain content.

tried to unzip .h5p file by renaming it, then there are only two folders

H5P.VideoGame and H5P.Video

the content folder and h5p.json files are missing.

But package upload is working fine if I pack my library alone using below command

zip -rDX videoGame.h5p *

But it does not include H5P.Video library.

otacke's picture

tried to unzip .h5p file by renaming it

Hihi, does Windows still try to determine the file type by extension only :-D

then there are only two folders

H5P.VideoGame and H5P.Video

the content folder and h5p.json files are missing.

That's perfectly fine. There's nothing missing if you're not expecting content files. You can upload that H5P library file on the H5P library settings page.

But package upload is working fine if I pack my library alone using below command

zip -rDX videoGame.h5p *

One should not zip manually, but I guess you've read that comment of mine here before.

But it does not include H5P.Video library.

You're zipping an videoGame.h5p file. That does not make sense at all. Please just stick with the H5P CLI tool.

What are you creating by the way? Anything that the H5P community can see soon?

Best,
Oliver

That's perfectly fine. There's nothing missing if you're not expecting content files. You can upload that H5P library file on the H5P library settings page.

But without content folder and h5p.json file I am not upload the file into Drupal H5p editor.

BV52's picture

Hi arun.ak,

This is why Oliver has suggested that you upload it in the library settings instead of the Hub/H5P editor. Refer to his comments.

-BV

otacke's picture

Hey all! Yes, kind of running in circles :-D

Drupal has an H5P library settings page (Content => H5P Libraries) that is supposed to accept mere library files that do not contain content.

 

And I am still interested: What are you creating? When will the H5P community get something to play with?