jitsi / jitsi-meet

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
https://jitsi.org/meet
Apache License 2.0
22.13k stars 6.59k forks source link

Jitsi Android App doesn't work with USB camera #1973

Closed vietpham87 closed 5 years ago

vietpham87 commented 6 years ago

I installed Android on my Raspberry Pi and after that, I tried install Jitsi meet and I got an issue : Jitsi meet app doesn't work with USB camera.

Any ideal for my issue ?

Thanks

saghul commented 6 years ago

Interesting. I don't think we are ready to handle that. Does the webcam work in the Chrome browser / other apps?

vietpham87 commented 6 years ago

@saghul : Yes, Usb camera working on other apps ( eg : USB camera, CameraFi...) Jitsi app now allow to use build in camera not allow to use External Camera ( Usb camera).

saghul commented 6 years ago

Thanks!

devsoniakor commented 5 years ago

Hi, I am keen to solve this problem and get USB cameras working on Android devices. I have a test app (containing an activity with Jitsi SDK and a separate activity with oney/react-native-webrtc on its own) and a USB webcam connected to my device, and it works sometimes (like 5% of the time) but displays a green screen for the rest of the time. I believe the issue is in react-native-webrtc because the issue is present even when not using jitsi-meet. I have some time to work on it, but I'm unfamiliar with react-native-webrtc and finding the code a bit daunting. Could you give me any tips on where to start. Thanks.

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

vakrolme commented 4 years ago

@devsoniakor did you make it work?

There's a component called react-native-uvc-camera, I think it might be the answer.

Tech4Life-salman commented 3 years ago

Can we add USB camera code in android native sdk using JAVA ?

waris-itdeveloper commented 2 years ago

No Feature found for MicroScope UVC Camera...... which is very useful in medical for ears inspection

tanzil114 commented 1 month ago

@saghul I really need to get USB cameras to work with Jitsi, can you please help. I have spent countless hours to get Jitsi to work on android tv, and the meeting itself is working well. But the USB camera doesn't work, and as soon as i allow the USB camera permission, the app crashes with following error:

CameraUvc: onConnect device = /dev/bus/usb/001/002 OrientationEventListener: Cannot detect sensors. Invalid disable CameraUvc: stopPreviewInternal CameraUvc: find some device list, = [/dev/bus/usb/001/002] OrientationEventListener: Cannot detect sensors. Not enabled libUVCCamera: [8886*serenegiant_usb_UVCCamera.cpp:59:setField_long]:__setField_long:field 'mNativePtr' not found AndroidRuntime: FATAL EXCEPTION: camera_manager AndroidRuntime: Process: com.example.testapp, PID: 8431 AndroidRuntime: java.lang.NoSuchFieldError: no "J" field "mNativePtr" in class "Lcom/jiangdg/uvc/UVCCamera;" or its superclasses AndroidRuntime: at com.jiangdg.uvc.UVCCamera.nativeCreate(Native Method) AndroidRuntime: at com.jiangdg.uvc.UVCCamera.<init>(Unknown Source:18) AndroidRuntime: at ue.h.b0(Unknown Source:62) AndroidRuntime: at ue.h.A(Unknown Source:0) AndroidRuntime: at com.jiangdg.ausbc.camera.ICameraStrategy.handleMessage(Unknown Source:100) AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102) AndroidRuntime: at android.os.Looper.loopOnce(Looper.java:201) AndroidRuntime: at android.os.Looper.loop(Looper.java:288) AndroidRuntime: at android.os.HandlerThread.run(HandlerThread.java:67) JitsiMeetSDK: JitsiMeetUncaughtExceptionHandler FATAL ERROR JitsiMeetSDK: java.lang.NoSuchFieldError: no "J" field "mNativePtr" in class "Lcom/jiangdg/uvc/UVCCamera;" or its superclasses JitsiMeetSDK: at com.jiangdg.uvc.UVCCamera.nativeCreate(Native Method) JitsiMeetSDK: at com.jiangdg.uvc.UVCCamera.<init>(Unknown Source:18) JitsiMeetSDK: at ue.h.b0(Unknown Source:62) JitsiMeetSDK: at ue.h.A(Unknown Source:0) JitsiMeetSDK: at com.jiangdg.ausbc.camera.ICameraStrategy.handleMessage(Unknown Source:100) JitsiMeetSDK: at android.os.Handler.dispatchMessage(Handler.java:102) JitsiMeetSDK: at android.os.Looper.loopOnce(Looper.java:201) JitsiMeetSDK: at android.os.Looper.loop(Looper.java:288) JitsiMeetSDK: at android.os.HandlerThread.run(HandlerThread.java:67) JitsiMeetSDK: JitsiMeetSDK: java.lang.NoSuchFieldError: no "J" field "mNativePtr" in class "Lcom/jiangdg/uvc/UVCCamera;" or its superclasses JitsiMeetSDK: at com.jiangdg.uvc.UVCCamera.nativeCreate(Native Method) JitsiMeetSDK: at com.jiangdg.uvc.UVCCamera.<init>(Unknown Source:18) JitsiMeetSDK: at ue.h.b0(Unknown Source:62) JitsiMeetSDK: at ue.h.A(Unknown Source:0) JitsiMeetSDK: at com.jiangdg.ausbc.camera.ICameraStrategy.handleMessage(Unknown Source:100) JitsiMeetSDK: at android.os.Handler.dispatchMessage(Handler.java:102) JitsiMeetSDK: at android.os.Looper.loopOnce(Looper.java:201) JitsiMeetSDK: at android.os.Looper.loop(Looper.java:288) JitsiMeetSDK: at android.os.HandlerThread.run(HandlerThread.java:67) ActivityTaskManager: Force finishing activity com.example.testapp/org.jitsi.meet.sdk.JitsiMeetActivity

Note: I am using Brio 101 camera. Android SDK version: org.jitsi.react:jitsi-meet-sdk:9.0.2 It's a Flutter app (using Flutter 3.3.7) that is using method channels to use native android code to integrate the jitsi sdk.

saghul commented 1 month ago

The UVC support library was too buggy and we have removed it from the SDK. Sorry, but we currently don't have support for USB cameras unless the device's kernel provides support for it without UVC.

tanzil114 commented 1 month ago

@saghul Oh. Thanks for the reply. Does that mean I won't be able to use Camera at all for Android TV? Because most Android TVs don't have built in cameras, especially the one I am bound to use. Can you please tell me some work around for this. We are at a point, where we can't go back to using anything other than Jitsi, since we have already put lots of efforts into integrating it with our app. If you could point me in the right direction, it will be much appreciated.

Are there are different types of cameras that will work with Jitsi. Or is there any viable way, in which I can maybe make changes to the source or sdk, to make the camera work?

saghul commented 1 month ago

Does that mean I won't be able to use Camera at all for Android TV?

It depends on the device, alas. The Nvidia Shield is able to use cameras no problem, since it seems to have a UVC in-kernel driver.

Can you please tell me some work around for this. We are at a point, where we can't go back to using anything other than Jitsi, since we have already put lots of efforts into integrating it with our app. If you could point me in the right direction, it will be much appreciated.

Are there are different types of cameras that will work with Jitsi. Or is there any viable way, in which I can maybe make changes to the source or sdk, to make the camera work?

If you are able to get the UVC package to work without crashing, there will be a way to "inject" it into Jitsi, even though we ship with no support for it.

The package in question: https://github.com/jiangdongguo/AndroidUSBCamera

tanzil114 commented 1 month ago

@saghul Thanks for sharing that. You mentioned that it was added in SDK before, could you please point me to that version, or give me a pointer on how will we inject the UVC package into Jitsi?

I checked CameraFi app and the USB camera works perfectly well on that in the same android TV. I wonder what they are doing differently. Do you have any idea? Maybe I can replicate that somehow?

Sorry for the many questions, but I am stuck, and not finding any way to move forward. Thanks in advance.

BTW for context, I am using an Amino Amigo android TV box.

saghul commented 1 month ago

You mentioned that it was added in SDK before, could you please point me to that version, or give me a pointer on how will we inject the UVC package into Jitsi?

The one you are using already has it, that's why you see the crash.

I checked CameraFi app and the USB camera works perfectly well on that in the same android TV. I wonder what they are doing differently. Do you have any idea? Maybe I can replicate that somehow?

I have no idea, sorry. If you can manage to know what library they use, that would be helpful.

Sorry for the many questions, but I am stuck, and not finding any way to move forward. Thanks in advance.

No worries, I wish the support for UVC was good enough for us to include...

BTW for context, I am using an Amino Amigo android TV box.

I don't have experience with those, sorry.

tanzil114 commented 1 month ago

@saghul I have finally managed to get the external camera to show display using this package (https://github.com/saki4510t/UVCCamera). Can you please tell me how do I "inject" this into Jitsi now?

saghul commented 1 month ago

It is not yet possible, we'll make it possible for the next release.

tanzil114 commented 1 month ago

@saghul Could you please tell me when is that release going to happen?

Also, can I make the change in webrtc and jitsi sdk to use the new usb camera package, and compile it?

tanzil114 commented 3 weeks ago

Hi @saghul. Could you please answer, I am trying to get the external uvc cam to work, and willing to do some extra work on the sdk side if needed. I made the cameras work using this package (https://github.com/saki4510t/UVCCamera) because I thought once it works I can inject it into jitsi sdk. That is done now. But now I don't know where to apply this change. Any help would be much appreciated. Thanks!

saghul commented 3 weeks ago

What answer do you want? It's not ready yet, that's all I can say.

tanzil114 commented 3 weeks ago

@saghul I saw that you guys added custom capturer (https://github.com/react-native-webrtc/react-native-webrtc/issues/1533). So, wanted to ask if that can be used to integrate a third party library that is capturing the video well, to the jitsi sdk?

tanzil114 commented 3 weeks ago

For anyone else experiencing the error:

java.lang.NoSuchFieldError: no "J" field "mNativePtr" in class "Lcom/jiangdg/uvc/UVCCamera;" or its superclasses

I was able to resolve it by adding this to proguard-rules.pro. Looks like due to code obfuscation, some important fields and symbols cannot be found, so we modify rules to avoid obfuscating the usb camera library.

-keep class com.jiangdg.**{ *; }
-keep class com.jiangdg.uvc.UVCCamera {
    *** mNativePtr;
}