ricecooker
ricecooker copied to clipboard
Handle H5P path attribute values to import for use in Kolibri
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.jsonand 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
contentfolder of the H5P file in a subfolder in there called "media" - Rewrite
pathto point to "media/{filename}" - by convention H5P refers to local file paths assuming a root of the content folder
Here are some h5p content kinds that we'll need "adapers" for:
- Image assets in timeline (see example here)
- iFrame embedder
- video assets in Image Hotspots (click on the biggest strawberry)
- (minor) Web font resources might need to offlined (see here)
We'll have to think about something generic that can be used by ricecooker and by Studio (when users upload through the Studio web interface).
Here are some content types which we cannot hope to get working:
- Audio Recorder
- Speak the Words and Speak the Words Set. Does not load at all in FF, and doesn't seem to work in Chrome.
We should probably remove these from the new demo channel.
@ivanistheone Regarding -
Here are some content types which we cannot hope to get working:
- Audio Recorder
- Speak the Words and Speak the Words Set. Does not load at all in FF, and doesn't seem to work in Chrome.
Have you tried on a server with https and Chrome? For example through kolibridemo?
Ref: https://support.google.com/chrome/forum/AAAAP1KN0B0AN8n3Ep78R0