interface IUrlGenerator {
    ajaxEndpoint(user: IUser): string;
    baseUrl(): string;
    contentFilesUrl(contentId: string): string;
    contentUserData(
        user: IUser,
        contextId?: string,
        asUserId?: string,
        options?: { readonly?: boolean },
    ): string;
    coreFile(file: string): string;
    coreFiles(): string;
    downloadPackage(contentId: string): string;
    editorLibraryFile(file: string): string;
    editorLibraryFiles(): string;
    libraryFile(library: IFullLibraryName, file: string): string;
    parameters(): string;
    play(): string;
    setFinished(user: IUser): string;
    temporaryFiles(): string;
    uniqueContentUrl(contentId: string): string;
}

Implemented by

Methods

  • Generates a URL at which the resources of the content can be loaded. Should be undefined if the default content serving mechanism is used. You only have to return a URL here if you want to change the hostname of the route, e.g. if the content files can be requested directly from S3 or a CDN.

    Parameters

    • contentId: string

    Returns string

    the URL or undefined (Example: http://127.0.0.1:9000/s3bucket/123`)

  • Generates a URL to which the user data can be sent.

    Parameters

    • user: IUser

      the user who is currently accessing the h5p object

    • OptionalcontextId: string

      allows implementation to have multiple user data objects for one h5p content object

    • OptionalasUserId: string
    • Optionaloptions: { readonly?: boolean }

    Returns string

  • Generates a URL by which the content can be globally identified (or accessed). The URL is used when generating ids for object in xAPI statements, so it could also be a fake URL that is only used to uniquely identify the content. It could also simply be the contentId. (default behavior) If you store the generated xAPI statement in a neutral LRS and users will see or be able to click the URL, you should customize the URL by overriding this method.

    Parameters

    • contentId: string

    Returns string