InputOptions: {
    crop?: ((frameWidth, frameHeight) => [cropX: number, cropY: number, cropWidth: number, cropHeight: number]);
    horizontalFlip?: boolean;
}

Customizes production of Input frames

Type declaration

  • Optional crop?: ((frameWidth, frameHeight) => [cropX: number, cropY: number, cropWidth: number, cropHeight: number])
      • (frameWidth, frameHeight): [cropX: number, cropY: number, cropWidth: number, cropHeight: number]
      • Crops the source frame

        Parameters

        • frameWidth: number
        • frameHeight: number

        Returns [cropX: number, cropY: number, cropWidth: number, cropHeight: number]

        Example

        player.use(
        new Webcam(),
        {
        // renders square frames
        crop: (width, height) => [(width - height) / 2, 0, height, height],
        },
        )
  • Optional horizontalFlip?: boolean

    Mirrors the source frames by X axis

    Example

    player.use(
    new MediaStream(
    await navigator.mediaDevices.getUserMedia({ video: true }),
    ),
    {
    horizontalFlip: true,
    },
    )