Creates a media stream builder that provides functionality to capture audio, video, and screen using the WebRTC API.

  • Parameters

    • Optionalparams: IParams

      The parameters for the media stream builder.

      • fallback

        The fallback function to be called when an error occurs during capture. It receives an Error object as its argument.

      • onLoadStart

        The callback function to be called when the capture starts.

      • onLoadEnd

        The callback function to be called when the capture ends.

      • onChange

        The callback function to be called when the media stream changes. It receives the media stream and an object with the current capture IDs as arguments.

      • throwError

        Determines whether to throw an error when an error occurs during capture instead of using the fallback function.

      • withInitialVideo

        Determines whether to capture video when the media stream builder is initialized.

      • withInitialAudio

        Determines whether to capture audio when the media stream builder is initialized.

      • compressFrame

        The factor to compress the video frame by. (COMPRESS_FRAME is a constant value)

      • maxFps

        The maximum frame rate of the video capture. (MAX_FPS is a constant value)

    Returns {
        hasAudioCapture: boolean;
        hasCameraCapture: boolean;
        hasScreenCapture: boolean;
        mediaStream: MediaStream;
        requestAudioCapture: () => Promise<void>;
        requestCameraCapture: () => Promise<void>;
        requestScreenCapture: () => Promise<void>;
        stopAudioCapture: () => void;
        stopCameraCapture: () => void;
        stopScreenCapture: () => void;
    }

    The media stream builder.