Skip to content

WebrtcCapturer

Ajša Terko edited this page Feb 15, 2024 · 2 revisions



takeLocalScreenshot(videoType)

Description

Creates a screenshot of the current user's camera or screen share.

Arguments

  • VideoType - The type of video that should be captured.

Returns

  • Promise<T> - A promise that resolves to a generic response depending on the type of capturer used.

Example

let infobipRTC = createInfobipRtc('2e29c3a0-730a-4526-93ce-cda44556dab5', {debug: true});
let webrtcCall = infobipRTC.callWebrtc('alice', WebrtcCallOptions.builder().setVideo(true).build());
let videoType = VideoType.CAMERA;

// take a screenshot of the current user's camera, and download it to the local machine as a `.png` file
webrtcCall.localCapturer().takeLocalScreenshot(videoType)
    .then(url => {
        const link = document.createElement('a');
        link.download = `local_${videoType.toString().toLowerCase()}.png`;
        link.href = url;
        link.click();
        link.remove();
    });



takeRemoteScreenshot(videoType)

Description

Creates a screenshot of the remote user's camera or screen share.

Arguments

  • VideoType - The type of video that should be captured.

Returns

  • Promise<T> - A promise that resolves to a generic response depending on the type of capturer used.

Example

let infobipRTC = createInfobipRtc('2e29c3a0-730a-4526-93ce-cda44556dab5', {debug: true});
let webrtcCall = infobipRTC.callWebrtc('alice', WebrtcCallOptions.builder().setVideo(true).build());
let videoType = VideoType.SCREENSHARE;

// take a screenshot of the remote user's screen share, which is directly uploaded to the server (cloud)
webrtcCall.serverCapturer().takeRemoteScreenshot(videoType)
    .then(fileResponse => {
        console.log(`Screenshot uploaded to the server with id: ${fileResponse.id}, and name: ${fileResponse.name}`);
    }).catch(err => {
        console.log('There was an error uploading a screenshot to the server!');
    });

Tutorials

Migration guides

Reference documentation

Clone this wiki locally