blackuy / react-native-twilio-video-webrtc

Twilio Video (WebRTC) for React Native
MIT License
604 stars 402 forks source link

App crashing on some of Android Devices #447

Open Mandy-1989 opened 3 years ago

Mandy-1989 commented 3 years ago

Here is the stack trace

2021-02-04 11:59:56.872 17837-17837/com.policepriority.incidentcode.dev E/AndroidRuntime: FATAL EXCEPTION: main Process: com.policepriority.incidentcode.dev, PID: 17837 java.lang.IllegalStateException: Supported formats could not be retrieved because an error occurred connecting to the camera service at com.twilio.video.Preconditions.checkState(Preconditions.java:447) at com.twilio.video.CameraCapturer.getSupportedFormats(CameraCapturer.java:338) at com.twiliorn.library.CustomTwilioVideoView.createLocalVideo(CustomTwilioVideoView.java:282) at com.twiliorn.library.CustomTwilioVideoView.connectToRoomWrapper(CustomTwilioVideoView.java:400) at com.twiliorn.library.CustomTwilioVideoViewManager.receiveCommand(CustomTwilioVideoViewManager.java:82) at com.twiliorn.library.CustomTwilioVideoViewManager.receiveCommand(CustomTwilioVideoViewManager.java:44) at com.facebook.react.uimanager.NativeViewHierarchyManager.dispatchCommand(NativeViewHierarchyManager.java:783) at com.facebook.react.uimanager.UIViewOperationQueue$DispatchCommandOperation.execute(UIViewOperationQueue.java:278) at com.facebook.react.uimanager.UIViewOperationQueue$1.run(UIViewOperationQueue.java:779) at com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches(UIViewOperationQueue.java:888) at com.facebook.react.uimanager.UIViewOperationQueue.access$2200(UIViewOperationQueue.java:42) at com.facebook.react.uimanager.UIViewOperationQueue$2.runGuarded(UIViewOperationQueue.java:846) at com.facebook.react.bridge.GuardedRunnable.run(GuardedRunnable.java:29) at android.os.Handler.handleCallback(Handler.java:883) at android.os.Handler.dispatchMessage(Handler.java:100) at android.os.Looper.loop(Looper.java:214) at android.app.ActivityThread.main(ActivityThread.java:7697) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:516) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)

Environment

react-native-twilio-video-webrtc

Version: npm version

After some investigation on the error, It is related to below code:

if (cameraCapturer.getSupportedFormats().size() > 0) { localVideoTrack = LocalVideoTrack.create(getContext(), enableVideo, cameraCapturer, buildVideoConstraints()); if (thumbnailVideoView != null && localVideoTrack != null) { localVideoTrack.addRenderer(thumbnailVideoView); } setThumbnailMirror(); }

It's unable to get Support formats and due to this app is getting crashed.

Twilio used in it : com.twilio:video-android:5.10.0

As per the official documentation, Twilio have resolved this issue in com.twilio:video-android:6.0

Can you please update library version and necessary change for new changes ?

slycoder commented 3 years ago

I haven't had a chance to really test but can you see if #452 fixes the issue?

Mandy-1989 commented 3 years ago

Hey @slycoder Thanks for the update. Let me check the solution.

vigilantee commented 3 years ago

Any updates @Mandy-1989 ? Did it work?

If yes when can we expect the release @slycoder for the PR?

slycoder commented 3 years ago

Just circling back here; did the PR resolve your issue?

Mandy-1989 commented 3 years ago

Hey @slycoder Couldn't get time to check back the issue as I have found another alternative for my problem.

I will definitely check the solution you have suggested and apply for the same and update here.