Options
All
  • Public
  • Public/Protected
  • All
Menu

Mapping between the event names supported by photo cam and the callback function type for the event.

Hierarchy

  • WebcamEventMap

Index

Methods

  • error(errorMessage: string): void
  • Fires when an error occurs.

    Parameters

    • errorMessage: string

      An error message describing the error that occurred.

    Returns void

  • live(): void
  • Fires when the user's camera goes live (i.e. showing a live preview). This will only happen after the user allows access to their camera.

    Returns void

  • load(): void
  • Fires when the library finishes loading.

    Returns void

  • uploadComplete(httpStatusCode: number, rawResponseContent: string): void
  • Fires once when the upload completes.

    Parameters

    • httpStatusCode: number

      Status code as received from the server.

    • rawResponseContent: string

      The raw response content as received from the server.

    Returns void

  • uploadProgress(progress: number): void
  • Fires repeatedly while an upload is in progress.

    If you want to track progress while your image is uploading, you can register an event listener for the uploadProgress event. This event is called very frequently while an upload is in progress, and passes the function a floating point number between 0.0 and 1.0 representing the upload progress:

    Webcam.snap(data_uri => {
    Webcam.on("uploadProgress", progress => {
    // Upload in progress
    // "progress" will be between 0.0 and 1.0
    });

    Webcam.on("uploadComplete", (code, text) => {
    // Upload complete!
    // "code" will be the HTTP response code from the server, e.g., 200
    // "text" will be the raw response content
    });

    Webcam.upload(data_uri, "myScript.php");
    });

    Parameters

    • progress: number

      A number between 0 and 1, indicating the current progress. 0 means that the upload just started, 1 means that the upload has finished.

    Returns void

Generated using TypeDoc