media.dart
915 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// // This is here because dart doesn't seem to support this properly
// // https://stackoverflow.com/questions/61161135/adding-support-for-navigator-mediadevices-getusermedia-to-dart
@JS('navigator.mediaDevices')
library media_devices;
import 'package:js/js.dart';
@JS('getUserMedia')
external Future<dynamic> getUserMedia(UserMediaOptions constraints);
@JS()
@anonymous
class UserMediaOptions {
external VideoOptions get video;
external factory UserMediaOptions({VideoOptions? video});
}
@JS()
@anonymous
class VideoOptions {
external String get facingMode;
// external DeviceIdOptions get deviceId;
external Map get width;
external Map get height;
external factory VideoOptions(
{String? facingMode, DeviceIdOptions? deviceId, Map? width, Map? height, });
}
@JS()
@anonymous
class DeviceIdOptions {
external String get exact;
external factory DeviceIdOptions({String? exact});
}