getSupportedConstraints method

  1. @override
MediaTrackSupportedConstraints getSupportedConstraints()
override

Returns MediaTrackSupportedConstraints recognized by a User Agent for controlling the Capabilities of a MediaStreamTrack object.

Implementation

@override
MediaTrackSupportedConstraints getSupportedConstraints() {
  final mediaDevices = html.window.navigator.mediaDevices;
  if (mediaDevices == null) throw Exception('Mediadevices is null');

  var _mapConstraints = mediaDevices.getSupportedConstraints();

  return MediaTrackSupportedConstraints(
      aspectRatio: _mapConstraints['aspectRatio'],
      autoGainControl: _mapConstraints['autoGainControl'],
      brightness: _mapConstraints['brightness'],
      channelCount: _mapConstraints['channelCount'],
      colorTemperature: _mapConstraints['colorTemperature'],
      contrast: _mapConstraints['contrast'],
      deviceId: _mapConstraints['_mapConstraints'],
      echoCancellation: _mapConstraints['echoCancellation'],
      exposureCompensation: _mapConstraints['exposureCompensation'],
      exposureMode: _mapConstraints['exposureMode'],
      exposureTime: _mapConstraints['exposureTime'],
      facingMode: _mapConstraints['facingMode'],
      focusDistance: _mapConstraints['focusDistance'],
      focusMode: _mapConstraints['focusMode'],
      frameRate: _mapConstraints['frameRate'],
      groupId: _mapConstraints['groupId'],
      height: _mapConstraints['height'],
      iso: _mapConstraints['iso'],
      latency: _mapConstraints['latency'],
      noiseSuppression: _mapConstraints['noiseSuppression'],
      pan: _mapConstraints['pan'],
      pointsOfInterest: _mapConstraints['pointsOfInterest'],
      resizeMode: _mapConstraints['resizeMode'],
      saturation: _mapConstraints['saturation'],
      sampleRate: _mapConstraints['sampleRate'],
      sampleSize: _mapConstraints['sampleSize'],
      sharpness: _mapConstraints['sharpness'],
      tilt: _mapConstraints['tilt'],
      torch: _mapConstraints['torch'],
      whiteBalanceMode: _mapConstraints['whiteBalanceMode'],
      width: _mapConstraints['width'],
      zoom: _mapConstraints['zoom']);
}