8000 Ambiguous facing mode config (different for iOS and Android) · Issue #16 · flutter-webrtc/flutter-webrtc · GitHub
[go: up one dir, main page]

Skip to content

Ambiguous facing mode config (different for iOS and Android) #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
rostopira opened this issue Oct 23, 2018 · 2 comments
Closed

Ambiguous facing mode config (different for iOS and Android) #16

rostopira opened this issue Oct 23, 2018 · 2 comments

Comments

@rostopira
Copy link
Collaborator
rostopira commented Oct 23, 2018

Following code enables rear camera on iOS but still uses front camera on Android

  final Map<String, dynamic> mediaConstraints = {
      'audio': true,
      'video': {
        'mandatory': {
          'minWidth': '1280',
          'minHeight': '720',
          'minFrameRate': '24'
        }
      },
      'facingMode': 'environment',
      'optional': []
    };
    _localStream = await navigator.getUserMedia(mediaConstraints);

Tested on Samsung Galaxy S8+ with Oreo 8.0 and on OnePlus 5T with custom rom 9.0

@rostopira
Copy link
Collaborator Author

This way it works:

    final Map<String, dynamic> mediaConstraints = {
      'audio': true,
      'video': {
        'mandatory': {
          'minWidth': '1280',
          'minHeight': '720',
          'minFrameRate': '24'
        },
        'facingMode': 'environment'
      },
      'facingMode': 'environment',
      'optional': []
    };
    _localStream = await navigator.getUserMedia(mediaConstraints);

Bug here: https://github.com/cloudwebrtc/flutter-webrtc/blob/master/android/src/main/java/com/cloudwebrtc/webrtc/GetUserMediaImpl.java#L318

@rostopira rostopira changed the title Facing mode not working on Android Ambiguous facing mode config (different for iOS and Android) Oct 26, 2018
@cloudwebrtc
Copy link
Member

The facingMode and optional needs to be a child kv of video, because this is a parameter about video.

'video': {
        'mandatory': {
          'minWidth': '1280',
          'minHeight': '720',
          'minFrameRate': '24'
        },
        'facingMode': 'environment'
        'optional': []
      },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0