Coder Social home page Coder Social logo

h5p-standalone's Introduction

H5P Standalone Player 3.x CircleCI

Display H5P content without the need for an H5P server

Installation

Source Info
yarn yarn add h5p-standalone
Release Download latest version here

Basic Usage

Ensure you have an extracted H5P zip file in your workspace folder first. A simple guide on how to extract an H5P zip file is provided here

The player can be set up either by directly calling the already built scripts and styles in your HTML page or using ES6 syntax.

Direct use

  1. Download the project latest release zipped source code from here

  2. Extract the downloaded zipped code in step 1 above

  3. Copy the contents of the dist folder into your workspace static assets folder ( The folder name does not matter. Remember the location for the next step )

  4. Add a div element in your HTML page where you want to display the H5P content. The div element should have a unique id attribute as compared to all other elements on the same page.

    <div id='h5p-container'></div>
  5. Include the H5P standalone main script in your HTML page (modify the path location if the files are not in the assets folder)

    <script type="text/javascript" src="assets/main.bundle.js"></script>
  6. Call the H5P player by providing arguments on where to find a div element and the location of the H5P content.

    const el = document.getElementById('h5p-container');
    const options = {
      h5pJsonPath:  '/h5p-folder',
      frameJs: '/assets/frame.bundle.js',
      frameCss: '/assets/styles/h5p.css',
    }
    new H5PStandalone.H5P(el, options);

    A detailed description of the H5P player arguments are provided under the advance section Simple instruction on how to extract H5P zipped file provided here

Using ES6

Install the player using yarn

yarn add h5p-standalone

Add an element to attach the player

<div id='h5p-container'></div>

initialize the H5P

import { H5P } from 'h5p-standalone'; // ES6
// const { H5P } = require('h5p-standalone'); AMD
// const { H5P } = 'H5PStandalone'; // object destructuring

const el = document.getElementById('h5p-container');
const options = {
    h5pJsonPath: '/h5p-folder',
    frameJs: '/assets/frame.bundle.js',
    frameCss: '/assets/styles/h5p.css',
};

new H5P(el, options);

A detailed description of the H5P player arguments are provided under the advance section

Advanced Usage

The standalone H5P player constructor accepts two arguments.

  1. A HTML element where the H5P iframe will be embedded as the first argument.
  2. JSON object with the following options :

H5P Options

  1. Basic options
Option name Required Description
h5pJsonPath Yes Path to the H5P content folder
frameCss Yes URL to the standalone player h5p.css
frameJs Yes URL to the standalone player frame.bundle.js
id No Player unique identifier. Randomly generated by default
librariesPath No Path where the player should find the H5P content libraries. Defaults to same as h5pJsonPath
contentJsonPath No Path where the player should find the H5P content.json file. Defaults to {h5pJsonPath}/content/,
frame No A boolean on whether to show H5P player frame and buttons
copyright No A boolean on whether display copyright button
export No A boolean on whether display a download button.
icon No A boolean on whether display H5P icon
downloadUrl No A path or a url that returns zipped h5p for download. The link is used by H5P export button
fullScreen No A boolean on whether to enable the fullscreen button if the browser supports the feature. Default is false
embed No A boolean on whether display embed button. Default is false. N.B. Setting this option to true will require an embedCode below.
embedCode unless embed is true Embed/Iframe code that user can insert on their site to view the same content. Check some caveats to consider below
customCss No Path(s) to custom stylesheet file(s)
customJs No Path(s) to custom script file(s)
xAPIObjectIRI No An identifier for a single unique Activity ~ utilized when generating xAPI object field. Default is page host+pathname
  1. User state & data (kindly refer to this section)
Option name Required Description
contentUserData No User previous content interaction state data. The data should be in JSON string format
saveFreq if contentUserData or ajax.* is set How often current user engagement content state should be autosaved (in seconds). Default is false.
postUserStatistics No Indicates if H5P should post the results once a finish event is triggered. Default is false. **** Requires ajax.setFinishedUrl property to be set
ajax No Object required if you need H5P to manage a learner's state
ajax.setFinishedUrl No Url where H5P should post the results once a finish event is triggered. **** Requires postUserStatistics to be set to true.
ajax.contentUserDataUrl No Endpoint where H5P can manage current user state. **** Requires user property to be set
user No Current user data object.
user.name Yes Used as xAPI actor's name
user.mail Yes User email. Uniquely identifies the xAPI actor

Note:

  • One can use absolute URL for frameCss, frameJs, and for other path options(h5pJsonPath,librariesPath, & librariesPath)
  • Any path that starts with a forward slash / is treated as relative to the site root.
  • Any path starting with a dot is treated to be in respect to the current page directory.

Example with advance options

import { H5P } from 'h5p-standalone';

const el = document.getElementById('h5p-container');

const options = {
    id: 'exercise-one',
    frameJs: './frame.bundle.js',
    frameCss: './styles/h5p.css',
    h5pJsonPath: '/path/to/h5p-folder',
    contentJsonPath: '/path/to/h5p-folder', //content is on same folder level as h5p.json
    librariesPath: '/path/to/shared/libaries', //shared libraries path
    frame: true, //required to display copyright,  embed, & export buttons
    copyright: true,
    export: false,
    icon: true,
    downloadUrl: '/path/to/exercise-one.h5p',
    fullScreen: true, //enable fullscreen button
    embed: true,
    embedCode:'<iframe width=":w" height=":h" src="https://replacethiswithyoururl.io" frameBorder="0" scrolling="no" styles="width:100%"></iframe>',
    customCss: ['/path/to/some-css.css', '/path/to/some-other-css.css'], // custom stylesheets
    customJs: '/path/to/custom-script.js' // custom script
  };


new H5P(el,options)
.then(() => {
  // do stuff
});

// Or using the async-await syntax (async wrapper function removed for readability) :
 await new H5P(el, options);

Multiple H5P players on the same page

To render multiple H5Ps, your code must be async aware.

import { H5P } from 'h5p-standalone';
const player1Options = {
    h5pJsonPath: '/h5p/exercise-one',
    frameJs: '/assets/frame.bundle.js',
    frameCss: '/assets/styles/h5p.css',
};

const player2Options = {
    h5pJsonPath: '/h5p/exercise-two',
    frameJs: '/assets/frame.bundle.js',
    frameCss: '/assets/styles/h5p.css',
};

const player1 = new H5P(document.getElementById('h5p-container-1'), player1Options);

player1.then(() => {
  return new H5P(document.getElementById('h5p-container-2'), player2Options);
}).then(() => {
  // do stuff
});


// OR (async wrapper function removed for readability)
await new H5P(document.getElementById('h5p-container-1'), player1Options);
await new H5P(document.getElementById('h5p-container-2'), player2Options);

Listening to xAPI events

To listen for xAPI events emitted by the player, you must wait for the player to finish loading and initializing the required content libraries. You can find more info about xAPI events here https://h5p.org/documentation/x-api

  1. Using then() method
const el = document.getElementById("h5p-container");
const options = {
  h5pJsonPath: "/h5p-folder",
  frameJs: "/assets/frame.bundle.js",
  frameCss: "/assets/styles/h5p.css",
};

new H5PStandalone.H5P(el, options).then(function () {
  H5P.externalDispatcher.on("xAPI", (event) => {
    //do something useful with the event
    console.log("xAPI event: ", event);
  });
});
  1. Using async function
import { H5P as H5PStandalone } from 'h5p-standalone'; //you need you an alias due to conflict

async function myAwesomePlayer() {
  const el = document.getElementById("h5p-container");
  const options = {
    h5pJsonPath: "/h5p-folder",
    frameJs: "/assets/frame.bundle.js",
    frameCss: "/assets/styles/h5p.css",
  };

  await new H5PStandalone(el, options);

  H5P.externalDispatcher.on("xAPI", (event) => {
    //do something useful with the event
    console.log("xAPI event: ", event);
  });
}

//don't forget to call the function
myAwesomePlayer();

Previous state restoration.

H5P provides two approaches for restoring a user's previous interaction state:

  1. using data provided with contentUserData option.
  2. automatically fetching the data if ajax.contentUserDataUrl is provided

For both cases, the saveFreq option must be set.

A summary of the previous state restoration process:

  1. If the contentUserData option is available, skip to the 3rd step.
  2. If contentUserData is not available but user.* and ajax.contentUserDataUrl options were provided, request the data from ajax.contentUserDataUrl endpoint.
  3. Process the previous state data as follows:
    • where data[0].state equals RESET, any previous state will be deleted
    • else, parse data[0].state string and pass it to the H5P player instance.

ajax.contentUserDataUrl may include (contentId,dataType,subContentId) placeholders that will be replaced with respective data automagically. Placeholders are prefixed with : Placeholders are effective when you need to query only current content user data.

ajax.contentUserDataUrl example: /api/users/123/h5p/:contentId?data_type=:dataType&subContentId=:subContentId

Caveats while adding embed code

  • This library includes an H5P resizer by default in main.bundle.js at the moment. But, to allow the iframe width to resize promptly, add CSS style setting the width to 100% i.e. style="width:100%;"
  • If you want to allow users to resize the iframe width and height, set them using placeholders provided by H5P i.e., width=":w" and height=":h"

An example that combines the above points:

<iframe width=":w" height=":h"
src="https://app.wikonnect.org/embed/JJuzs-OAACU"  //replace this with your URL
frameBorder="0" scrolling="no" styles="width:100%"></iframe>

Extracting H5P

  1. Rename the H5P file extension from .h5p file to .zip
  2. Extract the renamed file contents into your workspace h5p-folder folder

Testing during development

After modifying the project, build the files: yarn build to run available Cypress tests: yarn test

h5p-standalone's People

Contributors

0xmurage avatar benabel avatar bryandonmarc avatar cclauss avatar igobranco avatar jakeii avatar otacke avatar satyapearson avatar semantic-release-bot avatar tdxdave avatar tiagojacobs avatar usernamenumber avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

h5p-standalone's Issues

Activity id does not seem to be passed to xAPI events

Hi there ! I'm using your lib to display multiple H5P activities in a single page.
Each activity has an id set.
I'm also using H5P.externalDispatcher to track on xAPI events.
It works, every activity displayed sends events that are caught and forwarded by the dispatcher.
But every event I receive looks like this (note the object.id field ) :

Screenshot 2021-04-25 at 21 06 22

I've tried multiple kinds of id, even an URI (which, by the way, is a xAPI requirement).

I don't know what to do, I need this id to correctly handle the events. Do you have a solution, or a workaround ?

Edit : Here's the iframe code for the first activity, the content-id field is set to undefined.

<iframe id="h5p-iframe-undefined" class="h5p-iframe h5p-initialized" scrolling="no" data-content-id="undefined" style="width: 100%; height: 205px; border: medium none; display: block;" src="about:blank" frameborder="0"></iframe>

Have a good day,

Emeric

Interactive Book type: Javascript error - only one instance of babel-polyfill is allowed

Hi,

I've been using h5p-standalone to run H5P's offline and it's really great for that! Unfortunately a small minority of files, in particular interactive book, seem to have a javascript conflict. If you try the interactive book example from the h5p.org website, you will get the following Javascript error on both Chrome and Firefox:

Uncaught Error: only one instance of babel-polyfill is allowed
    at Object.<anonymous> (h5p-interactive-book.js:1)
    at Object.<anonymous> (h5p-interactive-book.js:1)
    at n (h5p-interactive-book.js:1)
    at Module.<anonymous> (h5p-interactive-book.js:10)
    at n (h5p-interactive-book.js:1)
    at h5p-interactive-book.js:1
    at h5p-interactive-book.js:1
h5p-interactive-book.js:10 Uncaught TypeError: Cannot read property 'title' of undefined
    at new e (h5p-interactive-book.js:10)
    at Object.i.newRunnable (frame.bundle.js:3)
    at HTMLDivElement.<anonymous> (frame.bundle.js:3)
    at Function.each (frame.bundle.js:3)
    at init.each (frame.bundle.js:3)
    at Object.i.init (frame.bundle.js:3)
    at HTMLDocument.<anonymous> (frame.bundle.js:3)
    at u (frame.bundle.js:3)
    at Object.fireWith [as resolveWith] (frame.bundle.js:3)
    at Function.ready (frame.bundle.js:3)

I'm not a Javascript expert, but it seems like babel-polyfill has been used in both h5p-standalone and in the above h5p content type. Babel-polyfill states that it should not be used in libraries for this reason.

Does anyone have any idea where babel-polyfill is being used in h5p-standalone? I am willing to prepare a pull request to deal with this. I think babel-polyfill should either be removed as a dependency (as it is already being used by H5P where needed) or there should be some kind of option for it.

Flickering scrollbar in Chrome.

In Chrome, the vertical scrollbar in the iframe flickers on and off.

At least it did for me with an interactive video, and others have similar issues elsewhere. See this forum post on h5p.org.

That post and its first comment also point out the fix: the h5p iframe should have scrolling="no".

I hacked this into my main.bundje.js and this fixes the problem.

I don't have the expertise to fix this properly in the source and create a pull request, but I think where I inserted it corresponds to line 42 in src/js/h5p-standalone.class.js (I found the correct place by searching the h5p-standalone code for where frameBorder="0" is set).

Standalone Editor

I am interested in creating a standalone version of the H5P editor. That is, it would be a javascript hosted version of the editor. It would have to contain links to the backend server urls to save content, of course. The idea is to separate the loading of all the javascript for the editor from the web/application server process.

Is this something that you might want to incorporate into this project? Do you know if anyone has already tried this?

Drag-and-Drop-Exercises: TypeError undefined object after dropping element

First of all, thank you Jakeii and to the others working on this h5p standalone project.

Using standalone for many types there is an issue: Drag-and-Drop-Exercises (Type question, not text) do not work properly in a Standalone-Container: When an element is dragged and then dropped, a TypeError occurs:

TypeError: undefined is not an object (evaluating 'n.data("uiDraggable").originalPosition={top:o.y+"%",left:o.x+"%"}')

Have a look at the Stack where the error occurs:
stack

As this works without an error in the standard context, it might be that there is h5p-standalone mixing something upโ€ฆ? Any ideas?

doesn't render in IE

Hi,

I love this - it will be really useful for what I'd like to do...

I can get this working fine in Chrome, Firefox etc. however not in IE, (specifically Edge)...

I've tried polyfills as suggested in a closed issue however I'm still not able to resolve this...
new error: Uncaught (in promise) TypeError: Object doesn't support property or method 'find'

My understanding is too limited to be able to resolve this alone so I would really appreciate some guidance if possible?

Shared library to reduce redundancy for multiple workspaces

Wouldn't it make sense to separate the actual content files (workspace/content and workspace/h5p.json) from the rest of the workspace libraries? If I place multiple h5p packages on the same server they could use a shared library with all the dependencies.

Solution to use the h5p embed iframe and the reuse button?

The hp5-standalone solution is just great to use hp5 anywherer. To embed h5p content very easily to an an other webpage it is possible to use the iframe code shown under a hp5 content with an additional script for dynamic sizing.

It is also possiblie to use this feature in the hp5-standalone version?

Actually the field are blank:
Unbenannt

Improving the instructions

... for those of is who don't know much about (I think) Node.

I'm happy to put something together for the Wiki (or the Readme) but as someone with little to no experience with Javascript (or Node, which I think is also required) the current documentation is a little too bare bones. If there are any pointers I can try and capture the rest of the process.

FWIW my goal is to enable my students to run work through an h5p "module" on their own computers without requiring a persistent internet connection.

Invalid characters

I downloaded the chart example from h5p.org: https://h5p.org/chart. When I look at the file on h5p.org on Safari, it renders fine. When I test it the same file using the plugin on safari, I get some errors. The errors are below. I also notice that the imported scripts in the iframe are different using the plugin than what h5p.org uses to render the same .h5p file.

[Error] SyntaxError: Invalid character '\u20ac'
(anonymous function) (d3.js:1225)
[Error] ReferenceError: Can't find variable: d3
PieChart (pie.js:15)
(anonymous function) (chart.js:109)
(anonymous function) (frame.bundle.js:3:111288)
(anonymous function) (frame.bundle.js:3:101971)
each (frame.bundle.js:3:5478)
each (frame.bundle.js:3:2260)
(anonymous function) (frame.bundle.js:3:101012)
(anonymous function) (frame.bundle.js:3:130448)
u (frame.bundle.js:3:7900)
fireWith (frame.bundle.js:3:8695)
ready (frame.bundle.js:3:3522)
O (frame.bundle.js:3:781)

`H5P.getLibraryPath(<lib>)` returns `"undefined/<...>"`

When running a H5P using the new librariesPath parameter that needs to call H5P.getLibraryPath(<lib>) (for example to load assets) that call returns "undefined/<...>".

This.librariesPath = <path> is correctly written to the console, however, and everything else runs correctly, except for the fact that assets aren't loaded because the path is wrong.

Also, when I don't specify a librariesPath, I immediately get This.librariesPath = [object Object] written to the console, and the main H5P library isn't even loaded because it tries to load /[object%20Object]/<lib>/library.json.

This happens when I build from current master (85c1138), which appears to be the correct version for 2.1.1 if I'm parsing the commit history correctly.

Content assets not loaded correctly when the H5P player page has a nested URL structure

Describe the user story:

As a user, I should be able to override the path to the H5P content folder.
Currently, if the player is placed inside a nested URL path e.g. https://mysite.com/sample/h5p-player.html, the path retrieving the local content assets such as images and videos does not work.

Tasks (where applicable)

  • If the H5P location is a relative path, the content path should always start site origin (exclude any pathname).
  • Allows users to be able to override the H5P content path
  • Add instructions for those without advance coding knowledge who wish to use the library out-of-box #39 #45
  • Update JQuery dependency #48
  • Bump the package version

Tests (where applicable)

librariesPath ignored

Great project. Thank you.

I am having an issue with the librariesPath. I move my libraries to a separate directory in my project, and then pass the librariesPath into the H5P function. However, when the h5P standalone loads, it is still trying to load the libraries from the local content path. Is there a certain format the library file structure needs to be in for this to accept my library path?

my libraries are in /h5p/libraries

for example /h5p/libraries/H5P.Video-1.5
but it is trying to load from '/h5p_packages/base'

below is my example code.

`
const options = {
// Optional unique ID, by default will be randomly generated
frameJs: '/js/frame.bundle.js',
frameCss: '/css/h5p.css'
};

    const displayOptions = { // Customise the look of the H5P
        frame: false,
        copyright: true,
        embed: false,
        download: false,
        icon: true,
        export: false
      };

    const librariesPath = "/h5p/libraries";
    const h5pLocation = '/h5p_packages/base';
    const el = document.getElementById('h5p-container'); //,librariesPath
    const h5p = await new H5P(el, h5pLocation, options,displayOptions,librariesPath);`

Unexpected token

See attached screenshot

Screen Shot 2020-07-26 at 10 59 09

This is my component

import React, { Component } from 'react';
import { H5P } from 'h5p-standalone';

export default class QuizViewer extends Component {
    constructor(props) {
        super(props);
    }

    componentDidMount() {
        const el = document.getElementById('h5p-container');
        const h5pLocation = '../h5p/test';

       
        const h5p = new H5P(el, h5pLocation);
        h5p.then(() => {
            // do stuff
           alert('loaded');
        }).catch((e) => {
            alert(e);
        })
    }


    render() {
        return (
            <div id="h5p-container"></div>
        )
    }
}

Virtual Tour (360) not working

I tried to provide the 360ยฐ example file with h5p standalone, but got the following error when viewing it:

TypeError: this.mainLibrary.preloadedCss is undefined h5p-standalone-main.min.js:1:106590

I suspect that this content type is not yet supported, right? Anyone have any idea what the problem is?

Timeline JS interactive shows as blank

To reproduce,
Download the example timeline type and use with the standalone project. It will show as blank.

In debugging this appears to be because standalone.frame.min.js is looking for some files in folders called TimelineJS and H5P.Timeline which don't exist (perhaps they did once?).

The quick fix has been to duplicate the TimelineJS-1.1 folder and name it TimelineJS and duplicate the H5P.Timeline-1.1 and name it H5P.Timeline.

Hiding Action Bar buttons

First, thanks for the project!

I've used the DisplayOptions object in my script, but as far as I can see it doesn't hide buttons that are set to false; instead their actions come up empty or something like that.

I think a better UX would be to have that object show or hide the buttons in question.

Responsive h5p height without overflowing browser window

I recently applied a "hack" (I call it a hack because it not a proper solution) to be able to show the full h5p content in the page and I thought it would be a good idea to share with you. Without this modification the iframe of the h5p overflows the browser window height and displays scrollbars. Thus the navigation bar of the h5p is not visible.

EDIT: as you can see bellow this hack is applicable to the template of course presentation and maybe you have to make adjustments to make it work for other kinds. Thanks to @shippeli for mentioning that... In the comments bellow I also provide the adjustment for the interactive video template. If you make another working adjustment for the other kinds please share in a comment bellow.

The final result is available here:
http://dschool.thedevelopers.gr/plastics/

I think it would be great if this functionality is implemented in the code.

Without the "hack". (Please notice the scrollbars at the right)

With the "hack". (There are no scrollbars and the content adjusts the width, so that the h5p never overflows the visible screen)

Here is the code that I used to implement this

<html>
<head>
  <link type="text/css" rel="stylesheet" media="all" href="./dist/styles/h5p.css" />
  <meta charset="utf-8" />
  <script type="text/javascript" src="./dist/js/h5p-standalone-main.min.js"></script>
  <script type="text/javascript">
    (function($) {
      $(function() {
        $('.h5p-container').h5p({
            frameJs: './dist/js/h5p-standalone-frame.min.js',
            frameCss: './dist/styles/h5p.css',
            h5pContent: './workspace',
            displayOptions: { // OPTIONAL hide the frame or download, export etc. buttons they are visible by default
                frame: false,
                copyright: false,
                embed: false,
                download: false,
                icon: false,
                export: false
            }
        });
          $(window).resize(function(){
              let height = window.innerHeight;
              $('.h5p-container').css('max-width', height*1.7777+'px');
          });

          $('iframe').load(function(){
              $(window).trigger('resize');
          })

      });
     
    })(H5P.jQuery);
  </script>
  <style>
    .h5p-container {
      display: block;
      margin: 0 auto;
    }
    body {
      margin: 0;
    }
  </style>
</head>
  <body>
    <div class="h5p-container"></div>
  </body>
</html>

I calculated the width / height ratio and noticed that it is approximately 1.7777. So I get the height of the window and then adjust the width of the h5p container using this ratio every time the user resizes the window.

Then I trigger the resize event when the iframe loads so that I can achieve the "hack" when the initial load happens.

Finally, I could not resolve the problem with the fullscreen button that is not working.. If someone has a hint about it please help me..

Only dependencies declared in h5p.json loaded

For all the cases I've tested until now this has worked fine, but now with a certain H5P.QuestionSet based H5P, there seem to be deeper levels of dependencies that need to be loaded.

For Example:
H5P.QuestionSet depends on H5P.JoubelUI which depends on H5P.Transition

but H5P.Transition isn't declared in h5p.json so it's not loaded.

How to get results

Hello, I'm creating a proof of concept to use a h5p-dictation content-type inside our Laravel website.

I could successfully load the content ( thanks to this project! ), however I don't know how to access the results when the activity is complete.

Is there any callback that I can implement?

I've tried this, without success:

H5PStandalone.H5P.externalDispatcher.on('xAPI', ()=>{
    console.log("Event");
});

Any tip/help is appreciated.

Thanks

Script tags while displaying h5p contents

Hey, I am new to all this HTML, CSS, JS. I would like to integrate h5p into my webpage but the issue is <script>H5PIntegration = {"baseUrl":"http:\/\/localhost","url":"\/wp-content\/uploads\/h5p","postUserStatistics":true,"ajax":{"setFinished":"http:\/\/localhost\/wp-admin\/admin-ajax.php?token=64fae661e4&action=h5p_setFinished","contentUserData":"http:\/\/localhost\/wp-admin\/admin-ajax.php?token=7f8db7740e&action=h5p_contents_user_data&content_id=:contentId&data_type=:dataType&sub_content_id=:subContentId"},"saveFreq":false,"siteUrl":"http:\/\/localhost","l10n":{"H5P":{"fullscreen":"Fullscreen","disableFullscreen":"Disable fullscreen","download":"Download","copyrights":"Rights of use","embed":"Embed","size":"Size","showAdvanced":"Show advanced","hideAdvanced":"Hide advanced","advancedHelp":"Include this script on your website if you want dynamic sizing of the embedded content:","copyrightInformation":"Rights of use","close":"Close","title":"Title","author":"Author","year":"Year","source":"Source","license":"License","thumbnail":"Thumbnail","noCopyrights":"No copyright information available for this content.","downloadDescription":"Download this content as a H5P file.","copyrightsDescription":"View copyright information for this content.","embedDescription":"View the embed code for this content.","h5pDescription":"Visit H5P.org to check out more cool content.","contentChanged":"This content has changed since you last used it.","startingOver":"You'll be starting over.","by":"by","showMore":"Show more","showLess":"Show less","subLevel":"Sublevel","confirmDialogHeader":"Confirm action","confirmDialogBody":"Please confirm that you wish to proceed. This action is not reversible.","cancelLabel":"Cancel","confirmLabel":"Confirm","licenseU":"Undisclosed","licenseCCBY":"Attribution","licenseCCBYSA":"Attribution-ShareAlike","licenseCCBYND":"Attribution-NoDerivs","licenseCCBYNC":"Attribution-NonCommercial","licenseCCBYNCSA":"Attribution-NonCommercial-ShareAlike","licenseCCBYNCND":"Attribution-NonCommercial-NoDerivs","licenseCC40":"4.0 International","licenseCC30":"3.0 Unported","licenseCC25":"2.5 Generic","licenseCC20":"2.0 Generic","licenseCC10":"1.0 Generic","licenseGPL":"General Public License","licenseV3":"Version 3","licenseV2":"Version 2","licenseV1":"Version 1","licensePD":"Public Domain","licenseCC010":"CC0 1.0 Universal (CC0 1.0) Public Domain Dedication","licensePDM":"Public Domain Mark","licenseC":"Copyright"}},"hubIsEnabled":true,"user":{"name":"admin","mail":"[email protected]"},"core":{"styles":["\/wp-content\/plugins\/h5p\/h5p-php-library\/styles\/h5p.css?ver=1.10.1","\/wp-content\/plugins\/h5p\/h5p-php-library\/styles\/h5p-confirmation-dialog.css?ver=1.10.1","\/wp-content\/plugins\/h5p\/h5p-php-library\/styles\/h5p-core-button.css?ver=1.10.1"],"scripts":["\/wp-content\/plugins\/h5p\/h5p-php-library\/js\/jquery.js?ver=1.10.1","\/wp-content\/plugins\/h5p\/h5p-php-library\/js\/h5p.js?ver=1.10.1","\/wp-content\/plugins\/h5p\/h5p-php-library\/js\/h5p-event-dispatcher.js?ver=1.10.1","\/wp-content\/plugins\/h5p\/h5p-php-library\/js\/h5p-x-api-event.js?ver=1.10.1","\/wp-content\/plugins\/h5p\/h5p-php-library\/js\/h5p-x-api.js?ver=1.10.1","\/wp-content\/plugins\/h5p\/h5p-php-library\/js\/h5p-content-type.js?ver=1.10.1","\/wp-content\/plugins\/h5p\/h5p-php-library\/js\/h5p-confirmation-dialog.js?ver=1.10.1","\/wp-content\/plugins\/h5p\/h5p-php-library\/js\/h5p-action-bar.js?ver=1.10.1"]},"loadedJs":[],"loadedCss":[],"contents":{"cid-2":{"library":"H5P.InteractiveVideo 1.17","jsonContent":"{\"interactiveVideo\":{\"video\":{\"startScreenOptions\":{\"title\":\"Interactive Video\",\"hideStartTitle\":false,\"copyright\":\"\"},\"textTracks\":[{\"label\":\"Subtitles\",\"kind\":\"subtitles\",\"srcLang\":\"en\"}],\"files\":[{\"path\":\"https:\\\/\\\/www.youtube.com\\\/watch?v=8Yfo_7UrBTo\",\"mime\":\"video\\\/YouTube\",\"copyright\":{\"license\":\"U\"}}]},\"assets\":{\"interactions\":[{\"x\":46.868475991649,\"y\":38.404452690167,\"width\":10,\"height\":10,\"duration\":{\"from\":1,\"to\":11},\"libraryTitle\":\"True\\\/False Question\",\"action\":{\"library\":\"H5P.TrueFalse 1.2\",\"params\":{\"correct\":\"true\",\"l10n\":{\"trueText\":\"True\",\"falseText\":\"False\",\"score\":\"You got @score of @total points\",\"checkAnswer\":\"Check\",\"showSolutionButton\":\"Show solution\",\"tryAgain\":\"Retry\",\"wrongAnswerMessage\":\"Wrong answer\",\"correctAnswerMessage\":\"Correct answer\",\"scoreBarLabel\":\"You got :num out of :total points\"},\"behaviour\":{\"enableRetry\":true,\"enableSolutionsButton\":true,\"disableImageZooming\":false,\"confirmCheckDialog\":false,\"confirmRetryDialog\":false,\"autoCheck\":false},\"confirmCheck\":{\"header\":\"Finish ?\",\"body\":\"Are you sure you wish to finish ?\",\"cancelLabel\":\"Cancel\",\"confirmLabel\":\"Finish\"},\"confirmRetry\":{\"header\":\"Retry ?\",\"body\":\"Are you sure you wish to retry ?\",\"cancelLabel\":\"Cancel\",\"confirmLabel\":\"Confirm\"},\"question\":\"<p>This is an interaction.<\\\/p>\\n\"},\"subContentId\":\"4edd48f6-cd39-4ffe-9e0f-b883eadad0a1\"},\"pause\":false,\"displayType\":\"button\",\"buttonOnMobile\":false,\"adaptivity\":{\"correct\":{\"allowOptOut\":false,\"message\":\"\"},\"wrong\":{\"allowOptOut\":false,\"message\":\"\"},\"requireCompletion\":false},\"label\":\"<p>TEST<\\\/p>\\n\"}]},\"summary\":{\"task\":{\"library\":\"H5P.Summary 1.8\",\"params\":{\"intro\":\"Choose the correct statement.\",\"summaries\":[{\"subContentId\":\"b5872686-f5a6-4042-ac95-3d0b84dd1dbf\",\"tip\":\"\"}],\"overallFeedback\":[{\"from\":0,\"to\":100}],\"solvedLabel\":\"Progress:\",\"scoreLabel\":\"Wrong answers:\",\"resultLabel\":\"Your result\",\"labelCorrect\":\"Correct.\",\"labelIncorrect\":\"Incorrect! Please try again.\",\"labelCorrectAnswers\":\"Correct answers.\",\"tipButtonLabel\":\"Show tip\",\"scoreBarLabel\":\"You got :num out of :total points\",\"progressText\":\"Progress :num of :total\"},\"subContentId\":\"87403620-750b-4535-a56e-929391594825\"},\"displayAt\":3}},\"override\":{\"autoplay\":false,\"loop\":false,\"showBookmarksmenuOnLoad\":false,\"showRewind10\":false,\"preventSkipping\":false,\"deactivateSound\":false},\"l10n\":{\"interaction\":\"Interaction\",\"play\":\"Play\",\"pause\":\"Pause\",\"mute\":\"Mute\",\"unmute\":\"Unmute\",\"quality\":\"Video Quality\",\"captions\":\"Captions\",\"close\":\"Close\",\"fullscreen\":\"Fullscreen\",\"exitFullscreen\":\"Exit Fullscreen\",\"summary\":\"Summary\",\"bookmarks\":\"Bookmarks\",\"defaultAdaptivitySeekLabel\":\"Continue\",\"continueWithVideo\":\"Continue with video\",\"playbackRate\":\"Playback Rate\",\"rewind10\":\"Rewind 10 Seconds\",\"navDisabled\":\"Navigation is disabled\",\"sndDisabled\":\"Sound is disabled\",\"requiresCompletionWarning\":\"You need to answer all the questions correctly before continuing.\",\"back\":\"Back\",\"hours\":\"Hours\",\"minutes\":\"Minutes\",\"seconds\":\"Seconds\",\"currentTime\":\"Current time:\",\"totalTime\":\"Total time:\",\"navigationHotkeyInstructions\":\"Use key k for starting and stopping video at any time\",\"singleInteractionAnnouncement\":\"Interaction appeared:\",\"multipleInteractionsAnnouncement\":\"Multiple interactions appeared.\",\"videoPausedAnnouncement\":\"Video is paused\",\"content\":\"Content\"}}","fullScreen":"1","exportUrl":"\/wp-content\/uploads\/h5p\/exports\/test-2-2.h5p","embedCode":"<iframe src=\"http:\/\/localhost\/wp-admin\/admin-ajax.php?action=h5p_embed&id=2\" width=\":w\" height=\":h\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe>","resizeCode":"<script src=\"http:\/\/localhost\/wp-content\/plugins\/h5p\/h5p-php-library\/js\/h5p-resizer.js\" charset=\"UTF-8\"><\/script>","url":"http:\/\/localhost\/wp-admin\/admin-ajax.php?action=h5p_embed&id=2","title":"Test 2","displayOptions":{"frame":true,"export":true,"embed":true,"copyright":true,"icon":true},"contentUserData":[{"state":"{}"}],"scripts":["\/wp-content\/uploads\/h5p\/cachedassets\/b32b19c89c5ad430f1f75d9e9187dc120640e638.js"],"styles":["\/wp-content\/uploads\/h5p\/cachedassets\/b32b19c89c5ad430f1f75d9e9187dc120640e638.css"]},"cid-1":{"library":"H5P.InteractiveVideo 1.17","jsonContent":"{\"interactiveVideo\":{\"video\":{\"startScreenOptions\":{\"title\":\"Interactive Video\",\"hideStartTitle\":false,\"copyright\":\"\"},\"textTracks\":[{\"label\":\"Subtitles\",\"kind\":\"subtitles\",\"srcLang\":\"en\"}],\"files\":[{\"path\":\"https:\\\/\\\/www.youtube.com\\\/watch?v=jY1szuZy57w\",\"mime\":\"video\\\/YouTube\",\"copyright\":{\"license\":\"U\"}}]},\"assets\":{\"interactions\":[{\"x\":47.807933194154,\"y\":46.103896103896,\"width\":10,\"height\":10,\"duration\":{\"from\":10,\"to\":13},\"libraryTitle\":\"Multiple Choice\",\"action\":{\"library\":\"H5P.MultiChoice 1.10\",\"params\":{\"answers\":[{\"correct\":true,\"tipsAndFeedback\":{\"tip\":\"\",\"chosenFeedback\":\"\",\"notChosenFeedback\":\"\"},\"text\":\"<div>Not Me<\\\/div>\\n\"},{\"correct\":false,\"tipsAndFeedback\":{\"tip\":\"\",\"chosenFeedback\":\"\",\"notChosenFeedback\":\"\"},\"text\":\"<div>Me<\\\/div>\\n\"}],\"overallFeedback\":[{\"from\":0,\"to\":100}],\"UI\":{\"checkAnswerButton\":\"Check\",\"showSolutionButton\":\"Show solution\",\"tryAgainButton\":\"Retry\",\"tipsLabel\":\"Show tip\",\"scoreBarLabel\":\"You got :num out of :total points\",\"tipAvailable\":\"Tip available\",\"feedbackAvailable\":\"Feedback available\",\"readFeedback\":\"Read feedback\",\"wrongAnswer\":\"Wrong answer\",\"correctAnswer\":\"Correct answer\",\"shouldCheck\":\"Should have been checked\",\"shouldNotCheck\":\"Should not have been checked\",\"noInput\":\"Please answer before viewing the solution\"},\"behaviour\":{\"enableRetry\":true,\"enableSolutionsButton\":true,\"type\":\"auto\",\"singlePoint\":false,\"randomAnswers\":true,\"showSolutionsRequiresInput\":true,\"disableImageZooming\":false,\"confirmCheckDialog\":false,\"confirmRetryDialog\":false,\"autoCheck\":false,\"passPercentage\":100,\"showScorePoints\":true},\"confirmCheck\":{\"header\":\"Finish ?\",\"body\":\"Are you sure you wish to finish ?\",\"cancelLabel\":\"Cancel\",\"confirmLabel\":\"Finish\"},\"confirmRetry\":{\"header\":\"Retry ?\",\"body\":\"Are you sure you wish to retry ?\",\"cancelLabel\":\"Cancel\",\"confirmLabel\":\"Confirm\"},\"question\":\"<p>Who is a dick ?<\\\/p>\\n\"},\"subContentId\":\"0bb5efca-2d2f-4297-bd21-6cfd5c5fc617\"},\"pause\":false,\"displayType\":\"button\",\"buttonOnMobile\":false,\"adaptivity\":{\"correct\":{\"allowOptOut\":false,\"message\":\"\"},\"wrong\":{\"allowOptOut\":false,\"message\":\"\"},\"requireCompletion\":false},\"label\":\"\"}]},\"summary\":{\"task\":{\"library\":\"H5P.Summary 1.8\",\"params\":{\"intro\":\"<p>Choose the correct statement.<\\\/p>\\n\",\"overallFeedback\":[{\"from\":0,\"to\":100}],\"solvedLabel\":\"Progress:\",\"scoreLabel\":\"Wrong answers:\",\"resultLabel\":\"Your result\",\"labelCorrect\":\"Correct.\",\"labelIncorrect\":\"Incorrect! Please try again.\",\"labelCorrectAnswers\":\"Correct answers.\",\"tipButtonLabel\":\"Show tip\",\"scoreBarLabel\":\"You got :num out of :total points\",\"progressText\":\"Progress :num of :total\",\"summaries\":[{\"subContentId\":\"53e709f8-6ae8-4e5f-aee7-730d3569b3c1\",\"tip\":\"\"}]},\"subContentId\":\"4938ffea-e386-46ad-8c7b-b5dd3ffa7247\"},\"displayAt\":3}},\"override\":{\"autoplay\":false,\"loop\":false,\"showBookmarksmenuOnLoad\":false,\"showRewind10\":false,\"preventSkipping\":false,\"deactivateSound\":false},\"l10n\":{\"interaction\":\"Interaction\",\"play\":\"Play\",\"pause\":\"Pause\",\"mute\":\"Mute\",\"unmute\":\"Unmute\",\"quality\":\"Video Quality\",\"captions\":\"Captions\",\"close\":\"Close\",\"fullscreen\":\"Fullscreen\",\"exitFullscreen\":\"Exit Fullscreen\",\"summary\":\"Summary\",\"bookmarks\":\"Bookmarks\",\"defaultAdaptivitySeekLabel\":\"Continue\",\"continueWithVideo\":\"Continue with video\",\"playbackRate\":\"Playback Rate\",\"rewind10\":\"Rewind 10 Seconds\",\"navDisabled\":\"Navigation is disabled\",\"sndDisabled\":\"Sound is disabled\",\"requiresCompletionWarning\":\"You need to answer all the questions correctly before continuing.\",\"back\":\"Back\",\"hours\":\"Hours\",\"minutes\":\"Minutes\",\"seconds\":\"Seconds\",\"currentTime\":\"Current time:\",\"totalTime\":\"Total time:\",\"navigationHotkeyInstructions\":\"Use key k for starting and stopping video at any time\",\"singleInteractionAnnouncement\":\"Interaction appeared:\",\"multipleInteractionsAnnouncement\":\"Multiple interactions appeared.\",\"videoPausedAnnouncement\":\"Video is paused\",\"content\":\"Content\"}}","fullScreen":"1","exportUrl":"\/wp-content\/uploads\/h5p\/exports\/test-ashim-1.h5p","embedCode":"<iframe src=\"http:\/\/localhost\/wp-admin\/admin-ajax.php?action=h5p_embed&id=1\" width=\":w\" height=\":h\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe>","resizeCode":"<script src=\"http:\/\/localhost\/wp-content\/plugins\/h5p\/h5p-php-library\/js\/h5p-resizer.js\" charset=\"UTF-8\"><\/script>","url":"http:\/\/localhost\/wp-admin\/admin-ajax.php?action=h5p_embed&id=1","title":"Test Ashim","displayOptions":{"frame":true,"export":true,"embed":true,"copyright":true,"icon":true},"contentUserData":[{"state":"{}"}],"scripts":["\/wp-content\/uploads\/h5p\/cachedassets\/b30c2b944deb49c9d72c1f9a339974f6787fbab8.js"],"styles":["\/wp-content\/uploads\/h5p\/cachedassets\/b30c2b944deb49c9d72c1f9a339974f6787fbab8.css"]}}};</script><link rel='stylesheet' id='h5p-core-styles-h5p-css' href='http://localhost/wp-content/plugins/h5p/h5p-php-library/styles/h5p.css?ver=1.10.1' type='text/css' media='all' />
the above script is being loaded by the browser and is visible when viewing as source.
I would like to somehow store this in a js on the server and then use a src tag to the call the script.
Hope you understand my issue.
Regards.

Security update jQuery

Github's own dependabot warns of security issues regarding jQuery versions prior to 5.0

I have been using h5p-standalone with jquery ^3.5.1 so far without problems, is there any reason that this package still requests ~3.4.1 ?

About H5p contents on web page

Does the standalone h5p contents can be moved to a web page for easy viewing? I had tried and without any success. Can someone give me some leads for further information. Thank you very much.

No tag for version 2.1

Title says it all, I'm running into some issues and this would be nice so that I can be sure that I'm building the right version before I report them.

Example of Multiple Embeds

Could you add to the readme an example of embedding multiple h5p's on a single page?

Specifically, I'm confused about what the id attribute in the constructor does. I've tried:

$('.h5p-container-1').h5p({
    id: 1,
    frameJs: '../dist/js/h5p-standalone-frame.min.js',
    frameCss: '../dist/styles/h5p.css',
    h5pContent: '../workspace/multiple-choice'
});
$('.h5p-container-2').h5p({
    id: 2,
    frameJs: '../dist/js/h5p-standalone-frame.min.js',
    frameCss: '../dist/styles/h5p.css',
    h5pContent: '../workspace/interactive-video'
});

This throws TypeError: H5PIntegration.contents[("cid-" + e)] is undefined in h5p-standalone-main.min.js

I've tried leaving out the id, which only seems to work if h5pContent is the same. I've also have tried using the same id, which duplicates the first declared id, regardless of the value of the h5pContent attribute.

Which of the ~10mb files of the h5p ZIP are loaded?

I unzipped a h5p file which gives me a 10mb directory, but when including it with h5p-standalone, the Firefox network analysis showed a total network traffic of 369kb (including a 200kb video) which is perfectly fine. I would like to understand under which circumstances the other files get loaded so I can calculate the required network traffic better.

Build system is broken

It seems like the build system is broken here. The pre-built files in dist work. However if one does a normal build, e.g.

Steps to reproduce:

$ git clone [email protected]:tunapanda/h5p-standalone.git
$ cd h5p-standalone
$ npm install
$ npm install --dev
$ npm run build
$ npm run test

It will build the Javascript into dist, but then all tests fail with the following error:

  > Cannot assign to read only property 'exports' of object '#<Object>'

It also produces the following warning when being built:

WARNING in ./src/js/h5p-standalone.class.js 117:16-19
"export 'default' (imported as 'H5P') was not found in 'imports-loader?H5PIntegration=>window.H5PIntegration!H5P'
 @ ./src/js/index.js

WARNING in ./src/js/frame.js 9:15-18
"export 'default' (imported as 'H5P') was not found in 'imports-loader?H5PIntegration=>window.parent.H5PIntegration!H5P

Fullscreen broken: video only 150px high

I have an interactive video online using the instructions posted in issue 45, but the fullscreen seems to be broken.

The toolbar is full width, but the video is only 150px high :-/

See the page here.

Issue appears in both firefox and chrome.

HTML is only slightly changed from the example posted by sr258 (added some css to keep the video smaller by default, see below). But I tested it without the added <style> section and the problem persists.

<html>

<head>
    <title>Interactieve Video</title>
    <meta charset="utf-8" />
    <script src="main.bundle.js" type="text/javascript"></script>
    <style>
        body {
            background-color: #000;
            padding: 3vw;
            max-width: 60em;
            margin: 0 auto;
        }
    </style>
</head>

<body>
    <div id='h5p-container'></div>
    <script type="text/javascript">
        const el = document.getElementById('h5p-container');
        const h5pLocation = './workspace';
        const h5p = new H5PStandalone.H5P(el, h5pLocation);
    </script>
</body>

Download button doesn't do anything, some way to toggle Action frame visibility with Download/Embed/About buttons?

This is an enhancement request, as I can't seem to figure out how to disable the Download/Embed/About buttons or Action frame. It also looks like the Download button doesn't actually work to do anything, though it's shown by default.

In the Wordpress version, you can toggle them with the following options, but I don't see a way to control these in the standalone version. Could just be a setting in a json file somewhere?
Display action bar and frame
Download button
Embed button
Copyright button

TypeError: Cannot read property 'apply' of undefined

gulp demo
[23:10:43] Using gulpfile /var/www/html/h5p/h5p-standalone/gulpfile.js
/usr/lib/node_modules/gulp/bin/gulp.js:129
gulpInst.start.apply(gulpInst, toRun);
^

TypeError: Cannot read property 'apply' of undefined
at /usr/lib/node_modules/gulp/bin/gulp.js:129:19
at _combinedTickCallback (internal/process/next_tick.js:73:7)
at process._tickCallback (internal/process/next_tick.js:104:9)
at Module.runMain (module.js:606:11)
at run (bootstrap_node.js:383:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:496:3

Drag and Drop Doesn't Allow Items to be Moved once Placed, Results Always Zero

You can test this using the Drag and Drop example on h5p.org: https://h5p.org/drag-and-drop#example=63159

Once one of the labels has been clicked on and placed, it can no longer be moved and appears somewhat translucent (the appearance it is in while being dragged), rather than reverting back to solid once released as is the case on .org.

Because of this, the labels are not recognized as being in the correct placement, and the results are always zero.

2017-12-17_22-15-00

full screen on ios

I embedded an interactive video to my website, everything works fine on any device except the full screen button on iphones and ipads, when I click it nothing happens.
Do you have an idea how to solve this problem?

Multiple embeds - second H5P affects the first

When using the multiple embed setup() function the creation of a second H5P affects the first one.

Specifically, if the first H5P is an image hotspot activity and is on its own it works fine, however, if another H5P is added, the background image from the first not longer displays.

Inspection reveals that the image src references the folder of the second H5P not the first as it should. If the order of the two in the setup() function is reversed the problem disappears.

The attached file illustrates the problem.
issue-example.txt

Interactive Presentations with Dialog Cards (v1.7) are broken

Currently Interactive Presentations with Dialog Cards (version 1.7 or higher) do not work anymore:

TypeError: H5P.ConfirmationDialog is not a constructor. h5p-dialogcards.js:1:34901

As a brute force method I replaced the file h5p-content/H5P.Dialogcards-1.7/dist/h5p-dialogcards.js with the file version 1.6.2, which is about the same age as the last update of H5P Standalone. This seemed to solve the mentioned problem, but it might raise other problems.

It seems to be a growing problem that H5P is constantly evolving and H5P Standalone is stagnating and apparently no longer (?) maintained.

IE11 issues

Hi, the demo is working fine with non IE browsers.
IE11 throws an error: "Promise" is undefined (h5p-standalone-main.js at line 9505)
Is there any chance to get it running with IE11?
Thanks

medata and title

Hi,
Currently testing standalone player with quizzes and presentation content.
Seems the medata is not retrieved correctly and title names are not displayed on slides (when 'Show title' is active) and summaries.
Drag and drop content titles are displayed with default "Drag and drop" title.

In H5P.DragQuestion-1.13/h5p-drag-question.js, for title in summaries :

o.prototype.getTitle = function() {
        return H5P.createTitle(this.contentData && this.contentData.metadata && this.contentData.metadata.title ? this.contentData.metadata.title : "Drag and drop")
    }

And slide content :

questionTitle: this.contentData && this.contentData.metadata && this.contentData.metadata.title ? this.contentData.metadata.title : "Drag and drop"

Laurent

h5p.instances empty

Hello,

I am not sure if i am missing something obvious with the setup or if it is just not possible, within the current version when i create a new H5p element i can not get the populated instances.

ex: window.H5P.instances is one empty array

I can receive the xAPI events with window.H5P.externalDispatcher, but for events like focus in which i need the instance itself i can not access it.

Shouldn't the window.H5P.instances be populated with the H5P elements that exist on the page?

Bundled jQuery

Hi,

Will this work with a version of jQuery other than the one embedded in the script? It seems like a lot of extra weight if one already has jQuery present for other reasons.

Absolute path broken

Not sure what was the intention with this changes

But those broke the assets of a h5p if we pass one absolute url (with protocol)

ex:
if we pass a url like http://domain.com/h5p-test it returns http://current-domain.com/http://domain.com/h5p-test while getting the h5p assets

Set logged in user data

Hello,

Thank you for your project, very useful.

I'm wondering where you / I should set this part of the data in window.H5PIntegration :

"user": { // Only if logged in !
"name": "User Name",
"mail": "[email protected]"
},

Everybody is logged in on my website but i think you don't use that on your side.

Could you telle me what is the best way to do that ?

Thanks again

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.