-
Notifications
You must be signed in to change notification settings - Fork 0
WebrtcCapturer
Ajša Terko edited this page Feb 15, 2024
·
2 revisions
takeLocalScreenshot(videoType: VideoType): Promise<T>
takeRemoteScreenshot(videoType: VideoType): Promise<T>
Creates a screenshot of the current user's camera or screen share.
-
VideoType
- The type of video that should be captured.
-
Promise<T>
- A promise that resolves to a generic response depending on the type of capturer used.
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();
});
Creates a screenshot of the remote user's camera or screen share.
-
VideoType
- The type of video that should be captured.
-
Promise<T>
- A promise that resolves to a generic response depending on the type of capturer used.
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!');
});