how to add my own h5p interactive video in h5p in moodle

264 views Asked by At

I tried to find the solution to my question everywhere without a result.

Let me explain the problem. I have a moodle docker. We can install H5P there by following these steps in: https://github.com/h5p/moodle-mod_hvp

Now we can manually install the H5P libraries like Interactive Video, Quiz, etc. from the moodle running. We just have to Create a new course>H5p Interactive Content>Get and Install any library.

There are separate GitHub repos for these libraries. Now, for my own work, I have made some forked and made some changes to some of these repos of these libraries. Now I want to install my H5P libraries in my moodle without making to Pull request to the original H5P interactive video GitHub page.

I found that we can make some changes in the renderer.php as stated in: https://github.com/h5p/h5pmods-moodle-plugin

I have git cloned H5P along with my x.js file in moodle/mod. So the folder structure is moodle/mod/hvp/{all the files from H5P Interactive Video + my x.js}

Following the steps from https://github.com/h5p/h5pmods-moodle-plugin, I am doing:

 /**
     * Add scripts when an H5P is displayed.
     *
     * @param object $scripts Scripts that will be applied.
     * @param array $libraries Libraries that will be displayed.
     * @param string $embedType How the H5P is displayed.
     */
    public function hvp_alter_scripts(&$scripts, $libraries, $embedType) {
        console.log(process.cwd());
        global $CFG;
        $scripts[] = (object) array(
            'path'    => 'x.js',
            'version' => '?ver=0.0.1',
        );
    }

However, it is not working. I have already checked (without docker exec) that all the files are in the moodle/mod/hvp. I wonder if this strategy at all will work for something other than some styling css.

Can someone help me out here?

0

There are 0 answers