client-sdk-android icon indicating copy to clipboard operation
client-sdk-android copied to clipboard

camera failed in some devices

Open dat0106 opened this issue 2 years ago • 11 comments

Describe the bug camera in some devices (Redmi note 11pro, Redmi note 11, one plus) does not show in other device,

Screenshots 20230209_163503 (1)

Device Info:

  • Device: Redmi note 11pro
  • OS: Android 12
  • LiveKit SDK version: 1.1.6

dat0106 avatar Feb 09 '23 09:02 dat0106

I'am experiencing same issue on redmi note 7 device and changing version of protobuf to "3.21.12" solves it for me, can you please release a new version by merging this fix if possible @davidliu

Test-isom avatar Feb 24 '23 14:02 Test-isom

@Test-isom Hmm, I'll upgrade protobuf, but @dat0106 reported that it didn't end up fixing things, and I'm still unsure how this would fix things.

davidliu avatar Feb 27 '23 11:02 davidliu

Yeah i was going through his comment and even saw another videos he uploaded on youtube for issue, but for now i added these lines in build.gradle along with the livekit sdk dependency and since grade would take latest version of dependency if there are conflicting version so it works for me for now on redmi note devices.

//For https://github.com/livekit/client-sdk-android/issues/179 implementation "com.google.protobuf:protobuf-javalite:3.21.12"

But thanks a lot for the reply, will be actively following the repo for a better fix,until than this works for me so i guess no need for a updated sdk.

On 27-Feb-2023, at 5:16 PM, davidliu @.***> wrote:

@Test-isom https://github.com/Test-isom Hmm, I'll upgrade protobuf, but @dat0106 https://github.com/dat0106 reported that it didn't end up fixing things, and I'm still unsure how this would fix things.

— Reply to this email directly, view it on GitHub https://github.com/livekit/client-sdk-android/issues/179#issuecomment-1446186380, or unsubscribe https://github.com/notifications/unsubscribe-auth/A6DKUVYTKNPQ7L3JOTSHHNLWZSHZ7ANCNFSM6AAAAAAUWKSUNE. You are receiving this because you were mentioned.

Test-isom avatar Feb 27 '23 11:02 Test-isom

Protobuf updated to 3.22.0 in #186.

davidliu avatar Feb 27 '23 16:02 davidliu

I use Huawei tablet and Huawei mobile phone to test the same problem, but the system uses Huawei's own Harmony OS 3.0 system. The current test situation is that there is no video screen and only audio

lihongyang166 avatar Apr 12 '23 07:04 lihongyang166

You can pass in the LiveKitOverrides class to solve this problem, for example: LiveKit.create( appContext = MyApplication.getInstance2(), options = RoomOptions(adaptiveStream = true, dynacast = true), overrides = LiveKitOverrides( okHttpClient = OkHttpClientBuilder.builder(mutableListOf(HttpLoggingInterceptor { LogUtil.d(Constant.TAG_HTTP, it) }.setLevel(BODY))).build(), videoEncoderFactory = HardwareVideoEncoderFactory(EglBase.create().eglBaseContext, false, true), ) ) Resolve using HardwareVideoEncoderFactory.

MikuMikuQAQ avatar Apr 13 '23 09:04 MikuMikuQAQ

@MikuMikuQAQ Thank you very much, it has been solved!

lihongyang166 avatar Apr 15 '23 02:04 lihongyang166

Hmm, looks like there's some issues here, perhaps with either the simulcast encoding or software encoding. I'll dig into this a little more and see if we can fix it so that the overrides aren't needed.

davidliu avatar Apr 18 '23 04:04 davidliu

Looks like this device has issues with H264 simulcast, and then switches to VP8 encoding on the fly. At the moment, the server doesn't handle these switches well, and ends up failing.

davidliu avatar Apr 24 '23 14:04 davidliu

You can pass in the LiveKitOverrides class to solve this problem, for example: LiveKit.create( appContext = MyApplication.getInstance2(), options = RoomOptions(adaptiveStream = true, dynacast = true), overrides = LiveKitOverrides( okHttpClient = OkHttpClientBuilder.builder(mutableListOf(HttpLoggingInterceptor { LogUtil.d(Constant.TAG_HTTP, it) }.setLevel(BODY))).build(), videoEncoderFactory = HardwareVideoEncoderFactory(EglBase.create().eglBaseContext, false, true), ) ) Resolve using HardwareVideoEncoderFactory.

@MikuMikuQAQ @davidliu

this method can solve the camera problem on Huawei phones or Hongmeng OS, but there is a new problem with screen sharing: other phones cannot decode the screen sharing of Huawei phones or HarmonyOS.

If you don't use HardwareVideoEncoderFactory, the camera will have problems again, which is really worrying.

wzJun1 avatar Jul 10 '23 05:07 wzJun1

Copying over comment from #245

I think the better thing to do is to:

  • do not override to HardwareVideoEncoderFactory
  • publish videos with VP8 instead of H.264
    • this can be done either via changing it in your project settings (or config.yaml if self-hosting)
    • or setting videoCodec to vp8 in VideoTrackPublishOptions here

davidzhao avatar Jul 17 '23 15:07 davidzhao