androidreact-nativejitsijitsi-meet

Change the default camera in jitsi-sdk for android


I'm developing my own video-conference Android-App and using the jitsi-sdk. But I want to set the back camera of my Smartphone as default. The user can change it once the conference is launched, but my goal is to change it before the conference begins without user interactions.

I already tried to switch camera by creating a cameraCapturer/videoCapturer, but the JitsiMeetActivity opens the front camera. Also I tried to use the putExtra-method for the launch-intent.

So my Activity extends from the JitsiMeetActivity and after Setting the JitsiMeetConferenceOptions the Conference is launched as followed:

   Intent intent = new Intent(context, JitsiMeetActivity.class);
   intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
   intent.setAction("org.jitsi.meet.CONFERENCE");
   intent.putExtra("JitsiMeetConferenceOptions", options);
   startActivity(context, JitsiMeetActivity); 

After that, I can't change anything programmatically.

Is there any way to get the settings before the JitsiMeetActivity is opened?

I hope someone can help me.


Solution

  • Sorry for late answer, but i find solution... you need customize jitsi android sdk, for doing this you need mac, and setting it using docs

    After setting sdk, you need change only one line of code in CameraCaptureController.java in react-native-webrtc lib folder

    From this:

    @Override
    protected VideoCapturer createVideoCapturer() {
        String deviceId = ReactBridgeUtil.getMapStrValue(this.constraints, "deviceId");
        String facingMode = ReactBridgeUtil.getMapStrValue(this.constraints, "facingMode");
        return createVideoCapturer(deviceId, facingMode);
    }
    

    To this:

    @Override
    protected VideoCapturer createVideoCapturer() {
        String deviceId = ReactBridgeUtil.getMapStrValue(this.constraints, "deviceId");
        String facingMode = ReactBridgeUtil.getMapStrValue(this.constraints, "facingMode");
        return createVideoCapturer(deviceId, "environment");
    }
    

    And in your terminal do: ./gradlew assembleRelease

    Instructions to build own jitsi-meet-sdk:

    1. clone project from github
    2. run npm install in your terminal in root jitsi folder
    3. in jitsi-meet(root)/android folder you need run this command: ./android/scripts/release-sdk.sh /tmp/repo
    4. build android project in android studio from folder jitsi-meet(root)/android
    5. change code from sdk
    6. build apk from folder jitsi-meet(root)/android with running this command: ./gradlew assembleRelease