tunapanda/h5p-standalone

The "Send report" button disappears in the BOOK

Closed this issue · 5 comments

When viewing a book through h5p-standalone, the "Submit Report" button on the last screen disappears, which sends the results.
Screenshot_1
Screenshot_3

@getcher123 I didn't quite understand the problem.

Is the button missing altogether or the button disappears after results submission?

The button is missing altogether. On the first screen I showed the button on h5p.com.

@murageyun you could test this on https://3dfarm.ru/course

I have seen the problem. The button has to be enabled via configuration which is not clearly documented here https://github.com/h5p/h5p-interactive-book/blob/786c11ca05bf10bfeddac345cecc1967f0a1171a/src/scripts/app.js#L58-L63

Here is a workaround until a fix is created,

const el = document.getElementById('h5p-container');
const options = {
    h5pJsonPath: '/workspace/berries-28-441940',
    frameJs: 'https://unpkg.com/h5p-standalone/dist/frame.bundle.js',
    frameCss: 'https://unpkg.com/h5p-standalone/dist/styles/h5p.css',
    metadata: {
        title: "Book title here",
        license: "CC-BY-SA"
    },

    preventH5PInit: true //prevent h5p player from initialization
}

new H5PStandalone.H5P(el, options)
    .then(() => {
        H5PIntegration.reportingIsEnabled = true; //this is the trick
        H5P.init(); //initialize the h5p player
    })

            

Summary of the fix:

  • we are preventing the H5P player from initializing automatically (preventH5PInit: true)
  • enabling the button
  • doing the H5P player initialization explicitly

Thank you, this method works!