Description
Description
In order to support videos in H5P content kind, ricecooker needs to pre-process the .h5p
files to download the video URLs listed and make an offline copy.
Context
The H5P video and interactive video content types load their video files based on video.path
, e.g.
{
"interactiveVideo": {
"video": {
"files": [
{
"path": "https://h5p.org/sites/default/files/h5p/iv.webm",
"mime": "video/webm",
"copyright": {
"license": "CC BY",
"title": "Berry Smoothie",
"author": "Joanna Siemek",
"source": "http://vimeo.com/68264542",
"version": "4.0"
}
},
{
"path": "https://h5p.org/sites/default/files/h5p/iv.mp4",
"mime": "video/mp4",
"copyright": {
"license": "CC BY",
"title": "Berry Smoothie",
"author": "Joanna Siemek",
"source": "http://vimeo.com/68264542",
"version": "4.0"
}
}
],
The mime
key is used to select the appropriate "handler" for this video file, and there are three handles defined (see here).
Only the html5 video player is compatible with the Kolibri use case.
Goal
In order for H5P videos to work, we need to download all references and rewrite the path
attribute inside the .h5p file.
Possible next steps
Update the H5PConversionHandler (https://github.com/learningequality/ricecooker/blob/develop/ricecooker/utils/pipeline/convert.py#L314) to do the following during file processing (this may require extensions to the immediate parent class to allow for this custom processing and adding of files to the archive).
- Parse the
content/content.json
and recurse looking for any attributes named "path" - Download the file shown in
path
, using the pipeline to automatically handle and convert the file - Add the file into the
content
folder of the H5P file in a subfolder in there called "media" - Rewrite
path
to point to "media/{filename}" - by convention H5P refers to local file paths assuming a root of the content folder