H5P NodeJS Library
    Preparing search index...
    interface IH5PConfig {
        ajaxUrl: string;
        baseUrl: string;
        contentFilesUrl: string;
        contentFilesUrlPlayerOverride: string;
        contentHubContentEndpoint: string;
        contentHubEnabled: boolean;
        contentHubMetadataEndpoint: string;
        contentHubMetadataRefreshInterval: number;
        contentTypeCacheRefreshInterval: number;
        contentUserDataUrl: string;
        contentUserStateSaveInterval: number | boolean;
        contentWhitelist: string;
        coreApiVersion: { major: number; minor: number };
        coreUrl: string;
        customization: {
            global: {
                editor?: { scripts?: string[]; styles?: string[] };
                player?: { scripts?: string[]; styles?: string[] };
            };
        };
        disableFullscreen: boolean;
        downloadUrl: string;
        editorAddons?: { [machineName: string]: string[] };
        editorLibraryUrl: string;
        enableLrsContentTypes: boolean;
        exportMaxContentPathLength: number;
        fetchingDisabled: 0 | 1;
        h5pVersion: string;
        hubContentTypesEndpoint: string;
        hubRegistrationEndpoint: string;
        installLibraryLockMaxOccupationTime: number;
        installLibraryLockTimeout: number;
        librariesUrl: string;
        libraryConfig?: { [machineName: string]: any };
        libraryWhitelist: string;
        lrsContentTypes: string[];
        maxFileSize: number;
        maxTotalSize: number;
        paramsUrl: string;
        platformName: string;
        platformVersion: string;
        playerAddons?: { [machineName: string]: string[] };
        playUrl: string;
        proxy?: { host: string; port: number; protocol?: "http" | "https" };
        sendUsageStatistics: boolean;
        setFinishedEnabled: boolean;
        setFinishedUrl: string;
        siteType: "network" | "local" | "internet";
        temporaryFileLifetime: number;
        temporaryFilesUrl: string;
        uuid: string;
        load(): Promise<any>;
        save(): Promise<void>;
    }

    Implemented by

    Index

    Properties

    ajaxUrl: string

    URL prefix for all AJAX requests

    baseUrl: string

    The prefix that is added to all URLs.

    contentFilesUrl: string

    Base path for content files (e.g. images). Used in the player and in the editor.

    contentFilesUrlPlayerOverride: string

    Base path for content files (e.g. images) IN THE PLAYER. It MUST direct to a URL at which the content files for THE CONTENT BEING DISPLAYED must be accessible. This means it must include the contentId of the object! You can insert the contentId using the placeholder {{contentId}}.

    Example: http://127.0.0.1:9000/s3bucket/{{contentId}}`

    You can use this URL to load content files from a different server, e.g. S3 storage. Note that this only work for the player and not the editor.

    contentHubContentEndpoint: string

    The URL of the Content Hub that is used to query content.

    contentHubEnabled: boolean

    If true, the content hub is enabled.

    contentHubMetadataEndpoint: string

    The URL of the Content Hub at which you can retrieve metadata

    contentHubMetadataRefreshInterval: number

    Time after which the content hub metadata is considered to be outdated in milliseconds. User-configurable.

    contentTypeCacheRefreshInterval: number

    Time after which the content type cache is considered to be outdated in milliseconds. User-configurable.

    contentUserDataUrl: string

    URL prefix for content user data (e.g. the user state where a user left off displaying H5P content)

    contentUserStateSaveInterval: number | boolean
    contentWhitelist: string

    A list of file extensions allowed for content files. Contains file extensions (without .) separated by whitespaces.

    coreApiVersion: { major: number; minor: number }

    This is the version of the H5P Core (JS + CSS) that is used by this implementation. It is sent to the H5P Hub when registering there. Not user-configurable and should not be changed by custom implementations.

    coreUrl: string

    Path to the H5P core files directory.

    customization: {
        global: {
            editor?: { scripts?: string[]; styles?: string[] };
            player?: { scripts?: string[]; styles?: string[] };
        };
    }

    Options that change the looks and behavior of H5P.

    Type declaration

    • global: {
          editor?: { scripts?: string[]; styles?: string[] };
          player?: { scripts?: string[]; styles?: string[] };
      }

      Lists of JavaScript and CSS files that are added to the editor or player. The URLs in the lists are directly appended to the list of core scripts or styles without any modifications.

    disableFullscreen: boolean

    If true, the fullscreen button will not be shown to the user.

    downloadUrl: string

    Path to the downloadable H5P packages.

    editorAddons?: { [machineName: string]: string[] }

    You can specify which addons should be added to which library here.

    Type declaration

    • [machineName: string]: string[]

      The property name is the machine mame to which to add addons. The string array contains the machine names of addons that should be added.

    editorLibraryUrl: string

    Path to editor "core files"

    enableLrsContentTypes: boolean

    If set to true, the content types that require a Learning Record Store to make sense are offered as a choice when the user creates new content. User-configurable.

    exportMaxContentPathLength: number

    The maximum character count of paths of content files allowed when exporting h5p packages. If files would be longer, paths are shortened.

    fetchingDisabled: 0 | 1

    Unclear. Taken over from PHP implementation and sent to the H5P Hub when registering the site. User-configurable.

    h5pVersion: string

    This is the version of the PHP implementation that the NodeJS implementation imitates. Can be anything like 1.22.1 It is sent to the H5P Hub when registering there. Not user-configurable and should not be changed by custom implementations.

    hubContentTypesEndpoint: string

    The URL called to fetch information about the content types available at the H5P Hub. User-configurable.

    hubRegistrationEndpoint: string

    The URL called to register the running instance at the H5P Hub. User-configurable.

    installLibraryLockMaxOccupationTime: number

    The number of milliseconds that code has until a single library is installed. If this time is exceeded the lock will be freed and the library installation has failed.

    installLibraryLockTimeout: number

    How long to wait until a lock is acquired when installing a single library.

    librariesUrl: string

    The URL of the library files (= content types).

    libraryConfig?: { [machineName: string]: any }

    (optional) You can set server-wide custom settings for some libraries by setting the values here. As far as we know, this is currently only supported by H5P.MathDisplay. See https://h5p.org/mathematical-expressions for more information.

    libraryWhitelist: string

    A list of file extensions allowed for library files. (File extensions without . and separated by whitespaces.) (All extensions allowed for content files are also automatically allowed for libraries).

    lrsContentTypes: string[]

    The list of content types that are enabled when enableLrsContentTypes is set to true. Not user-configurable.

    maxFileSize: number

    The maximum allowed file size of content and library files (in bytes).

    maxTotalSize: number

    The maximum allowed file size of all content and library files in an uploaded h5p package (in bytes).

    paramsUrl: string

    The Url at which the parameters of a piece of content can be retrieved

    platformName: string

    This is the name of the H5P implementation sent to the H5P for statistical reasons. Not user-configurable but should be overridden by custom custom implementations.

    platformVersion: string

    This is the version of the H5P implementation sent to the H5P when registering the site. Not user-configurable but should be overridden by custom custom implementations.

    playerAddons?: { [machineName: string]: string[] }

    You can specify which addons should be added to which library in the player here.

    Type declaration

    • [machineName: string]: string[]

      The property name is the machine mame to which to add addons. The string array contains the machine names of addons that should be added.

    playUrl: string

    The Url at which content can be displayed.

    proxy?: { host: string; port: number; protocol?: "http" | "https" }

    Allows settings a http(s) proxy for outgoing requests. No proxy will be used if left undefined (or the one specified in the HTTPS_PROXY environment variable).

    Type declaration

    • host: string

      The hostname of the proxy without any protocol prefix (e.g. only 10.1.2.3)

    • port: number

      The port of the proxy, e.g. 8080.

    • Optionalprotocol?: "http" | "https"

      The protocol to use to access the proxy. Can be left undefined if http is used.

    sendUsageStatistics: boolean

    If true, the instance will send usage statistics to the H5P Hub whenever it looks for new content types or updates. User-configurable.

    setFinishedEnabled: boolean

    If true, the H5P client is told to send data about users finished a content object to the server. (This is the custom H5P setFinished report, not an xAPI statement)

    setFinishedUrl: string

    URL prefix for the finished URL (the URL to which requests are sent when the user has finished content)

    siteType: "network" | "local" | "internet"

    Indicates on what kind of network the site is running. Can be "local", "network" or "internet". TODO: This value should not be user-configurable, but has to be determined by the system on startup. (If possible.)

    temporaryFileLifetime: number
    temporaryFilesUrl: string

    The URL path of temporary file storage (used for image, video etc. uploads of unsaved content).

    uuid: string

    Methods

    • Loads all changeable settings from storage. (Should be called when the system initializes.)

      Returns Promise<any>

    • Saves all changeable settings to storage. (Should be called when a setting was changed.)

      Returns Promise<void>