File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -5,14 +5,16 @@ import 'dart:js_util' as jsutil;
55import 'package:webrtc_interface/webrtc_interface.dart' ;
66
77import 'media_stream_impl.dart' ;
8+ import 'utils.dart' ;
89
910class MediaDevicesWeb extends MediaDevices {
1011 @override
1112 Future <MediaStream > getUserMedia (
1213 Map <String , dynamic > mediaConstraints) async {
1314 try {
14- if (mediaConstraints['video' ] is Map ) {
15- if (mediaConstraints['video' ]['facingMode' ] != null ) {
15+ if (! isMobile) {
16+ if (mediaConstraints['video' ] is Map &&
17+ mediaConstraints['video' ]['facingMode' ] != null ) {
1618 mediaConstraints['video' ].remove ('facingMode' );
1719 }
1820 }
Original file line number Diff line number Diff line change 1+ import 'dart:html' as html;
2+
3+ bool get isMobile {
4+ final toMatch = [
5+ 'Android' ,
6+ 'webOS' ,
7+ 'iPhone' ,
8+ 'iPad' ,
9+ 'iPod' ,
10+ 'BlackBerry' ,
11+ 'Windows Phone'
12+ ];
13+ return toMatch.indexWhere ((device) => html.window.navigator.userAgent
14+ .contains (RegExp (device, caseSensitive: false ))) !=
15+ - 1 ;
16+ }
You can’t perform that action at this time.
0 commit comments