Exception if no FRONT_CAMERA available
Current bug behaviour
I'm testing video calls on API 22 Android emulator. After starting a video call there is a exception thrown (on version 0.5.0+4 it was saying that there is no front camera on this device) which says:
I/flutter ( 7765): PlatformException(INIT_ERROR, java.util.NoSuchElementException: Array contains no element matching the predicate., java.util.NoSuchElementException: Array contains no element matching the predicate. I/flutter ( 7765): at twilio.flutter.twilio_programmable_video.PluginHandler.getCameraId(PluginHandler.kt:561) I/flutter ( 7765): at twilio.flutter.twilio_programmable_video.PluginHandler.connect(PluginHandler.kt:376) I/flutter ( 7765): at twilio.flutter.twilio_programmable_video.PluginHandler.onMethodCall(PluginHandler.kt:102) I/flutter ( 7765): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:230) I/flutter ( 7765): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85) I/flutter ( 7765): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:692) I/flutter ( 7765): at android.os.MessageQueue.nativePollOnce(Native Method) I/flutter ( 7765): at android.os.MessageQueue.next(MessageQueue.java:143) I/flutter ( 7765): at android.os.Looper.loop(Looper.java:122) I/flutter ( 7765): at android.app.ActivityThread.main(ActivityThread.java:5254) I/flutter ( 7765): at java.lang.reflect.Method.invoke(Native Method) I/flutter ( 7765): at java.lang.reflect.Method.invoke(Method.java:372) I/flutter ( 7765): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) I/flutter ( 7765): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) I/flutter ( 7765): )
It works ok if CameraCapturer is initialized with BACK_CAMERA.
Expected behaviour
onCameraError event instead of exception, so call can be started with some error message or something. Also it would be great to have a possibility to check if front camera is available, to be able to fallback to audio-only call.
Steps to reproduce
- Run Android emulator without front camera (5.1 WVGA API 22).
- Start video call.
More environment information
- Plugin version: 0.6.0+0
- Platform affected: android