Moodle 3.1 h5p plugin 1.0-rc.6

Moodle: 3.1.4+ (Build: 20170209)

Plugin: 1.0-rc.6 2017010900

via github however cannot submodule a submodule in our environment so grabbed what was in editor and library and put them in manually. 

installed ok, updated libraries ok, but when trying to load up the editor when adding h5p as an activity it just spins and never loads (for most of the libraries - some load up ok eg accordion does, course presentation doesn't. )

not getting anything much in server errors.

am getting console errors when it fails to load:

Uncaught SyntaxError: Unexpected token u in JSON at position 0
    at JSON.parse (<anonymous>)
    at Object.success (h5peditor.js?ver=2017010900:72)
    at c (jquery.js?ver=2017010900:2)
    at Object.fireWith [as resolveWith] (jquery.js?ver=2017010900:2)
    at k (jquery.js?ver=2017010900:4)
    at XMLHttpRequest.r (jquery.js?ver=2017010900:4)

this happened before but it was a while ago and i'm not cure how it was resolved. I had this on WP and restarting php/nginx eventually fixed it.

Have tried cache clearing, restart apache etc. any ideas?

sorry if asked before - i did search. 



icc's picture

It sounds like you might not have gotten the correct submodules. Please use the ZIP file available from when installing.

thanks for reply. Will try on monday  - cheers

ok, installed from zip on moodle and am getting the same error.

falcon's picture

What did you get from the server in the ajax request that fails in JSON.parse? Could you check the network tab in your console?

no worries - attached. like before, it's certain libraries that won't load - this one is course presentation. i think the libraries are up to date and installed ok - not that sure where they get located to check or clear out.

icc's picture

Could you click the URL above the error message so that we can see the content returned(response) by the request?

not sure if helpful but attached is console when audio lib is loaded ok...


like this?...

icc's picture

No, you must click that last request starting with ajax.php?contextId=...

{error: "Cannot read file. Either the file does not exist or there is a permission problem.",…}
"[dataroot]/filedir/49/16/49163d1e8fdd066432b1ea71970b86cfd9d5f4e1↵Error code: storedfilecannotread"
"Cannot read file. Either the file does not exist or there is a permission problem."
"* line 460 of /lib/filestorage/stored_file.php: file_exception thrown↵* line 339 of /mod/hvp/classes/file_storage.php: call to stored_file->get_content()↵* line 341 of /mod/hvp/editor/h5peditor.class.php: call to mod_hvp\file_storage->getContent()↵* line 200 of /mod/hvp/ajax.php: call to H5peditor->getLibraryData()↵"
icc's picture

It looks like something went wrong either when installing the plugin or the content types. 

You could try downloading the attached .h5p file from the Update/install all recommended content types page and then uploading to H5P Libraries page from the Moodle admin menu.

If that doesn't work, try setting the following in Moodle's config.php and do the upload again:

$CFG->mod_hvp_dev = 1;

Remember to remove it afterward to avoid issues in the future. 

Also, check your server's error_log for messages after uploading the file.


falcon's picture

When you get this error there is a link above the error message starting with https://lmstest.murdoch.... could you click that link and paste in the result?

Where did you get the above error message from=?

thanks - thought that's what i clicked. done again - clicked ajax.php... clicked in top frame and in header response i see file permission error. 

will have another fiddle tomorrow - probably down to our test environment - needs a clean up. have installed and reinstalled libraries - get some errors about old version of h5p (tried adding the cfg too) - getting file errors in the apache log so it seems to point to that. 

[Mon Feb 13 17:32:32.569184 2017] [:error] [pid 15698] [client] Default exception handler: Cannot read file. Either the file does not exist or there is a permission problem. Debug: [dataroot]/filedir/4a/3c/4a3ca8afa207d7a2a1144d0f8b9bc118bdd97450\nError code: storedfilecannotread\n* line 460 of /lib/filestorage/stored_file.php: file_exception thrown\n* line 339 of /mod/hvp/classes/file_storage.php: call to stored_file->get_content()\n* line 341 of /mod/hvp/editor/h5peditor.class.php: call to mod_hvp\\file_storage->getContent()\n* line 200 of /mod/hvp/ajax.php: call to H5peditor->getLibraryData()\n, referer:

hi - installs ok in a fresh test environment - given up on the one I had before - the files are messed up, pretty sure that is what the issues was - apache errors all point to that. don't think uploading libs again works to overwrite anything. is there a way to remove all libraries? 

so basically ignore me :) appreciate the responses.

icc's picture

I'm glad to hear that it works in a fresh environment.
There's no easy automated way of uninstalling the libraries other that reinstalling the plugin. If it has to be done manually you should really know what you're doing not to break anything.

yeah, messing with moodle files is not for the faint hearted. pretty sure it's down to a test env that really needs wiping away and starting again.