Skip to content
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

java.lang.IllegalArgumentException FRONT_CAMERA is not supported on this device #545

Closed
Balasnest opened this issue Jul 15, 2020 · 6 comments
Assignees
Labels

Comments

@Balasnest
Copy link

Balasnest commented Jul 15, 2020

Description

Caused by: java.lang.IllegalArgumentException FRONT_CAMERA is not supported on this device 
    Preconditions.java:131 com.twilio.video.Preconditions.checkArgument
    CameraCapturer.java:323 com.twilio.video.CameraCapturer.<init>
    CameraCapturer.java:309 com.twilio.video.CameraCapturer.<init>
    CameraCapturer.java:309 com.twilio.video.CameraCapturer.<init>
    CameraCapturer.java:303 com.twilio.video.CameraCapturer.<init>
    CameraCapturer.java:303 com.twilio.video.CameraCapturer.<init>
    VideoActivity.java:491 com.app.videocall.VideoActivity.createAudioAndVideoTracks
    VideoActivity.java:290 com.app.videocall.VideoActivity.onCreate
    Activity.java:6303 android.app.Activity.performCreate
    Instrumentation.java:1108 android.app.Instrumentation.callActivityOnCreate
    ActivityThread.java:2402 android.app.ActivityThread.performLaunchActivity
    ActivityThread.java:2509 android.app.ActivityThread.handleLaunchActivity
    ActivityThread.java:153 android.app.ActivityThread.access$1000
    ActivityThread.java:1373 android.app.ActivityThread$H.handleMessage
    Handler.java:102 android.os.Handler.dispatchMessage
    Looper.java:154 android.os.Looper.loop
    ActivityThread.java:5523 android.app.ActivityThread.main
    Method.java:-2 java.lang.reflect.Method.invoke
    ZygoteInit.java:739 com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
    ZygoteInit.java:629 com.android.internal.os.ZygoteInit.main

One of our client reported that its always crashing when video call arise. We are showing local video on screen until user accept the call.

private void createAudioAndVideoTracks() {
        Logg("createAudioAndVideoTracks called!!!");
        // Share your microphone
        localAudioTrack = LocalAudioTrack.create(this, true, LOCAL_AUDIO_TRACK_NAME);

        // Share your camera
        cameraCapturer = new CameraCapturer(this, CameraCapturer.CameraSource.FRONT_CAMERA);
        localVideoTrack = LocalVideoTrack.create(this, true, cameraCapturer);
        primaryVideoView.setMirror(true);
        localVideoTrack.addRenderer(primaryVideoView);
        localVideoView = primaryVideoView;

        /*
         * Set the initial state of the UI
         */
        intializeUI();
    }

Note: Device camera is working fine both front and back camera.

What would be the exact issue for causing this crash?

Device info:
Screenshot 2020-07-15 at 6 47 21 PM

@Balasnest
Copy link
Author

@aaalaniz can you help here

@aaalaniz
Copy link
Contributor

Hey @Balasnest

Thanks for filing this issue!

Typically we have seen this issue occur when a device does not have a front or back camera available. The CameraCapturer API provides a static method isSourceAvailable that will check for the availability of a particular source. At first glance, I have no reason to believe that the Redmi 4A does not have a front camera though.

We have a Xiaomi MI 5s that we can test with. This may be a bug in the isSourceAvailable API. I will investigate and report back.

Thanks!

@aaalaniz aaalaniz added the bug label Jul 15, 2020
@Balasnest
Copy link
Author

Balasnest commented Jul 15, 2020

@aaalaniz Thanks for your quick reply. I have checked with the user. He stated that both side camera is working flawlessly in WhatsApp.

@Alton09
Copy link
Contributor

Alton09 commented Jul 28, 2020

@Balasnest We have recently cut a new release, 5.1.0, and believe it will fix the issue you are experiencing. Please let us know if you are still running into any issues when using the new release. Thanks!

@tl-robertmanley
Copy link

@Alton09 I'm working with the Camera2 API and was wondering if we could get support for LEGACY mode as the product we would like to use it on will not require any special cropping. Thanks!

@aaalaniz
Copy link
Contributor

Hey @tl-robertmanley Please open a separate issue for this request. Thank you!

I am closing this issue @Balasnest. Please open a new issue if you have any follow up.

Thanks!

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

No branches or pull requests

4 participants