Constructors

Methods

Constructors

Methods

  • Creates a frame for displaying H5P content. You can customize this frame by calling setRenderer(...). It normally is enough to call this method with the content id. Only call it with parameters and metadata if don't want to use the IContentStorage object passed into the constructor.

    Parameters

    • contentId: string

      the content id

    • actingUser: IUser

      the user who wants to access the content

    • language: string = 'en'
    • Optionaloptions: {
          asUserId?: string;
          contextId?: string;
          ignoreUserPermissions?: boolean;
          metadataOverride?: ContentMetadata;
          parametersOverride?: any;
          readOnlyState?: boolean;
          showCopyButton?: boolean;
          showDownloadButton?: boolean;
          showEmbedButton?: boolean;
          showFrame?: boolean;
          showH5PIcon?: boolean;
          showLicenseButton?: boolean;
      }
      • OptionalasUserId?: string

        (optional) allows you to impersonate another user. You will see their user state instead of yours.

      • OptionalcontextId?: string

        (optional) allows implementations to have multiple content states for a single content object and user tuple

      • OptionalignoreUserPermissions?: boolean
      • OptionalmetadataOverride?: ContentMetadata

        (optional) the metadata of a piece of content (=h5p.json); if you use this option, the parameters won't be loaded from storage

      • OptionalparametersOverride?: any

        (optional) the parameters of a piece of content (=content.json); if you use this option, the parameters won't be loaded from storage

      • OptionalreadOnlyState?: boolean

        (optional) allows you to disable saving of the user state. You will still see the state, but changes won't be persisted. This is useful if you want to review other users' states by setting asUserId and don't want to change their state. Note that the H5P doesn't support this behavior and we use a workaround to implement it. The workaround includes setting the query parameter ignorePost=yes in the URL of the content state Ajax call. The h5p-express adapter ignores posts that have this query parameter. You should, however, still prevent malicious users from writing other users' states in the permission system!

      • OptionalshowCopyButton?: boolean
      • OptionalshowDownloadButton?: boolean
      • OptionalshowEmbedButton?: boolean
      • OptionalshowFrame?: boolean
      • OptionalshowH5PIcon?: boolean
      • OptionalshowLicenseButton?: boolean

    Returns Promise<any>

    a HTML string that you can insert into your page