Auxiliary SDK module that enhances the Player with a feature like:

Hierarchy

  • Module

Constructors

Methods

Constructors

  • Creates a module from Url

    Parameters

    • source: string

    Returns Module

    Example

    const frx = new Module("/path/to/face_tracker.zip.zip")
    
  • Creates a module from Request

    Parameters

    • source: Request

    Returns Module

    Example

    const frx = new Module(new Request(
    "/path/to/face_tracker.zip",
    { headers: { etag: "\"a610ceb58d4fa6b8b13dff520339ba88\"" } },
    ))
  • Creates a module from Blob

    Parameters

    • source: Blob

    Returns Module

    Example

    const file = $("#file-upload").files[0] // File is subclass of Blob
    const frx = new Module(file)

Methods

  • Creates a module by preloading it from Url

    Parameters

    Returns Promise<Module>

    Example

    const frx = await Module.preload("/path/to/face_tracker.zip")
    

    Example

    // with a progress listener
    const onProgress = ({ total, transferred }) => {
    console.log(`Module is loaded on ${100 * transferred / total}%`)
    }
    const frx = await Module.preload("/path/to/face_tracker.zip", { onProgress })
  • Creates an array of modules by preloading them from a list of Urls

    Parameters

    Returns Promise<Module[]>

    Example

    const [frx, background] = await Module.preload(["modules/face_tracker.zip", "modules/background.zip"])
    

    Example

    // with a progress listener
    const onProgress = (effectIndex, { total, transferred }) => {
    console.log(`Module #${effectIndex} is loaded on ${100 * transferred / total}%`)
    }
    const [frx, background] = await Module.preload(
    ["effects/face_tracker.zip", "effects/background.zip"],
    { onProgress },
    )