awslabs / amazon-kinesis-video-streams-webrtc-sdk-js

JS SDK for interfacing with the Amazon Kinesis Video Streams Signaling Service.
https://awslabs.github.io/amazon-kinesis-video-streams-webrtc-sdk-js/examples/index.html
Apache License 2.0
285 stars 140 forks source link

Is forbidden to capture screen in default? #272

Closed hkkim-openbus closed 9 months ago

hkkim-openbus commented 9 months ago

We try to make a service for camera monitoring and capturing a screen from Raspberry Pi device with an Android or iOS app. I use web view in the app with sdk-js and capture the screen with Bitmap from the cache. But it can't capture only the monitoring screen. We found an attribute named "videoCapture" in sdk.amazonaws.com_js_aws-sdk-2.1165.0.min.js.

// sdk.amazonaws.com_js_aws-sdk-2.1165.0.min.js
// row 26 and 27
videoCapture: {type: "boolean"}

Is it forbidden in default or can I change this setting?

sirknightj commented 9 months ago

Hi @hkkim1021,

That videoCapture parameter doesn't belong to KVS. It belongs to AWS Device Farm: https://docs.aws.amazon.com/devicefarm/latest/APIReference/API_ExecutionConfiguration.html

Refer to the ImageCapture API for capturing images from a MediaStreamTrack: https://developer.mozilla.org/en-US/docs/Web/API/ImageCapture

Viewer receives the video track from the master on the peerConnection track event: https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/track_event

Sample [location]

viewer.peerConnection.addEventListener('track', async event => {
  printSignalingLog('[VIEWER] Received remote track');

  await new Promise(r => setTimeout(r, 3000));
  if (event.track.kind === 'video') {
      const imageCapture = new ImageCapture(event.track);
      const bitmapImage = await imageCapture.grabFrame();
      console.log(bitmapImage.height);
      console.log(bitmapImage.width);
  }

  ...
});