Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 310 and 311] [Versions 311 and 400] [Versions 311 and 401] [Versions 311 and 402] [Versions 311 and 403] [Versions 39 and 311]

H5P player class.

Copyright: 2019 Sara Arjona <sara@moodle.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 519 lines (18 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: player  - X-Ref

H5P player class, for displaying any local H5P content.

__construct(string $url, \stdClass $config, bool $preventredirect = true, string $component = '',bool $skipcapcheck = false)   X-Ref
Inits the H5P player for rendering the content.

param: string $url Local URL of the H5P file to display.
param: stdClass $config Configuration for H5P buttons.
param: bool $preventredirect Set to true in scripts that can not redirect (CLI, RSS feeds, etc.), throws exceptions
param: string $component optional moodle component to sent xAPI tracking
param: bool $skipcapcheck Whether capabilities should be checked or not to get the pluginfile URL because sometimes they

display(string $url, \stdClass $config, bool $preventredirect = true,string $component = '')   X-Ref
Get the encoded URL for embeding this H5P content.

param: string $url Local URL of the H5P file to display.
param: stdClass $config Configuration for H5P buttons.
param: bool $preventredirect Set to true in scripts that can not redirect (CLI, RSS feeds, etc.), throws exceptions
param: string $component optional moodle component to sent xAPI tracking
return: string The embedable code to display a H5P file.

get_messages()   X-Ref
Get the error messages stored in our H5P framework.

return: stdClass with framework error messages.

add_assets_to_page()   X-Ref
Create the H5PIntegration variable that will be included in the page. This variable is used as the
main H5P config variable.


output()   X-Ref
Outputs H5P wrapper HTML.

return: string The HTML code to display this H5P content.

get_title()   X-Ref
Get the title of the H5P content to display.

return: string the title

get_context()   X-Ref
Get the context where the .h5p file belongs.

return: context The context.

delete_h5p(\stdClass $content)   X-Ref
Delete an H5P package.

param: stdClass $content The H5P package to delete.

get_export_settings(bool $downloadenabled)   X-Ref
Export path for settings

param: bool $downloadenabled Whether the option to export the H5P content is enabled.
return: \moodle_url|null The URL of the exported file.

get_cid()   X-Ref
Get the identifier for the H5P content, to be used in the arrays as index.

return: string The identifier.

get_assets()   X-Ref
Get the core H5P assets, including all core H5P JavaScript and CSS.

return: Array core H5P assets.

get_filtered_parameters()   X-Ref
Get filtered parameters, modifying them by the renderer if the theme implements the h5p_alter_filtered_parameters function.

return: string Filtered parameters.

get_dependency_files()   X-Ref
Finds library dependencies of view

return: array Files that the view has dependencies to

get_resize_code()   X-Ref
Resizing script for settings

return: string The HTML code with the resize script.

get_embed_code(string $url, bool $embedenabled)   X-Ref
Embed code for settings

param: string $url The URL of the .h5p file.
param: bool $embedenabled Whether the option to embed the H5P content is enabled.
return: string The HTML code to reuse this H5P content in a different place.

get_embed_url(string $url, string $component = '')   X-Ref
Get the encoded URL for embeding this H5P content.

param: string $url The URL of the .h5p file.
param: string $component optional Moodle component to send xAPI tracking
return: \moodle_url The embed URL.

get_export_file()   X-Ref
Return the info export file for Mobile App.

return: array