AgoraIO-Extensions / Agora-Flutter-SDK

Flutter plugin of Agora RTC SDK for Android/iOS/macOS/Windows

Home Page:https://pub.dev/packages/agora_rtc_engine

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Agora local video preview stopped working on last repo code changes.

shoebkhan88 opened this issue · comments

Describe the bug
Local video preview was working both on android and ios using version 6.2.2. After the last code changes done on Agora-Flutter-SDK, local preview turned black screen. Remote video is fine.
Scenario:
Caller:

  1. Can see remote user video
  2. Cannot see local video (but local video transmitting)

Receiver:

  1. Can see remote user (caller) video
  2. Cannot see local video (receiver-side but local video transmitting)

This issue is only for engine.startPreview() where local preview has been broken.

Framework: Flutter
Tests performed on real device (Android and IPhone)

Console log:
I/flutter (12140): preview started
I/spdlog (12140): [2023-10-04 12:23:12.212] [12140] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_startPreview2 params {"sourceType":0}
I/agora.io(12140): (00000083): RtcEngine::startPreview(this:0xb400006e4abcffb0, {"sourceType":0})
I/spdlog (12140): [2023-10-04 12:23:12.214] [12140] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_startPreview2 ret 0 result {"result":0}
I/flutter (12140): preview started 1
I/agora.io(12140): API call to start preview for 0: create local camera track
I/agora.io(12140): [LVTM]: Start preview, sourceType: 0.
I/agora.io(12140): [video] built-in-preview-tee Start
I/agora.io(12140): [LVTM]: Start preview camera done, videoCount: 0
I/agora.io(12140): VideoCaptureCamera2: CrPreviewSessionListener.onConfigured
I/agora.io(12140): [LVTM]: Start preview, sourceType: 0.
I/agora.io(12140): [LVTM]: Start preview camera done, videoCount: 0
I/agora.io(12140): [LVTM]: Start preview, sourceType: 1.
E/agora.io(12140): [LVTM]: Start preview secondary camera failed, secondary camera track is null.
I/agora.io(12140): [LVTM]: Start preview, sourceType: 2.
E/agora.io(12140): [LVTM]: Start preview screen failed, screen track is null.
I/agora.io(12140): [LVTM]: Start preview, sourceType: 10.
E/agora.io(12140): [LVTM]: Start preview transcoded failed, transcoded track is null.
I/agora.io(12140): [LVTM]: Start preview, sourceType: 4.
E/agora.io(12140): [LVTM]: Start preview custom camera failed, custom camera track is null.

After the last code changes done on Agora-Flutter-SDK

Do you mean the code on the main branch?

BTW, can you try our example to see if there same issue?

same issue

@littleGnAl I have tried your example and still facing the same issue. Please see below console logs and screenshots
Specific testing logs (video): -------------------------------------------(1)
I/flutter ( 7558): RTCTesting: local preview started
I/flutter ( 7558): RTCTesting: Local user camera ON
I/flutter ( 7558): RTCTesting: Token applied 006ae8ff0f6a49d450a83599c7c54e1c455IAD1Irerp4pzsogdXCC+VBe6jBgXnL5rVKpRA0y2yYtx2X3U16+oqXMyEADtmL8DHgcsZQEAAQC+0Spl
I/flutter ( 7558): RTCTesting: Local video transmission started from source 0
I/flutter ( 7558): RTCTesting: Local user connection uid:2345678901 joined the channel
I/flutter ( 7558): RTCTesting: Remote user uid:1234567890 joined the channel
I/flutter ( 7558): RTCTesting: Remote user uid:1234567890 left the channel
I/flutter ( 7558): RTCTesting: Local user camera OFF

Specific testing Agora SDK logs (video): -------------------------------------------(2)
E/EGL_emulation(13086): tid 15735: eglQueryContext(2122): error 0x3004 (EGL_BAD_ATTRIBUTE)
I/agora.io(13086): [LVT]: local video state:1 error:0 last state:0
I/agora.io(13086): (00000126): RtcEngineEventHandlerCallback::onLocalVideoStateChanged->onLocalVideoStateChanged(this:0xb40000720cd1b208, state: 1, errorCode: 0)
I/agora.io(13086): [a264] this = 0x0xb4000071cce12050, Error:CWelsH264SVCEncoder::Initialize(), a264enc initialized successfully with ( bFastModeDecision 0, bTrellis 1, bEnableQpPred 1 bEnableRefOpt 0 bEnableRoi 0 )
I/agora.io(13086): [LVT]: local video state:2 error:0 last state:1
I/agora.io(13086): (00000177): RtcEngineEventHandlerCallback::onLocalVideoStateChanged->onLocalVideoStateChanged(this:0xb40000720cd1b208, state: 2, errorCode: 0)
I/agora.io(13086): [LAR]: NotifyTrackStateChange state: 1, errorCode: 0
I/agora.io(13086): (00000185): ChannelProxy::onLocalAudioTrackStateChanged->onLocalAudioTrackStateChanged(this:0xb40000729d704070, state:1 errorCode:0)
I/agora.io(13086): (00000186): RtcEngineEventHandlerCallback::onLocalAudioTrackStateChanged->onLocalAudioTrackStateChanged(this:0xb40000720cd1b208, state:1 errorCode:0)
I/agora.io(13086): [LAR]: NotifyTrackStateChange state: 2, errorCode: 0
I/agora.io(13086): (00000189): ChannelProxy::onLocalAudioTrackStateChanged->onLocalAudioTrackStateChanged(this:0xb40000729d704070, state:2 errorCode:0)
I/agora.io(13086): (00000190): RtcEngineEventHandlerCallback::onLocalAudioTrackStateChanged->onLocalAudioTrackStateChanged(this:0xb40000720cd1b208, state:2 errorCode:0)
E/agora.io(13086): [ap-6][tds] OnError to 118.
**.38:8443, transport type = aut(5), error type = 4
I/agora.io(13086): (00000225): AudioDeviceEventManager::CallbackOnError->CallbackOnError(this:0xb4000071fcd20840, errCode: 1166)

I/agora.io(13086): audio_device_event_handler_android.cpp: (line 71): ApplyFallbackStrategy receive error 1166
I/agora.io(13086): ADGM: CallbackOnError errCode 1166
I/agora.io(13086): [ASM]: CallbackOnError errCode 1166
I/agora.io(13086): (00000226): AudioDeviceEventManager::CallbackOnError->CallbackOnError(this:0xb4000071fcd20840, errCode: 1166)
I/agora.io(13086): audio_device_event_handler_android.cpp: (line 71): ApplyFallbackStrategy receive error 1166
I/agora.io(13086): ADGM: CallbackOnError errCode 1166
I/agora.io(13086): [ASM]: CallbackOnError errCode 1166
I/agora.io(13086): (00000227): AudioDeviceEventManager::CallbackOnError->CallbackOnError(this:0xb4000071fcd20840, errCode: 1166)
I/agora.io(13086): audio_device_event_handler_android.cpp: (line 71): ApplyFallbackStrategy receive error 1166
I/agora.io(13086): ADGM: CallbackOnError errCode 1166
I/agora.io(13086): [ASM]: CallbackOnError errCode 1166
I/agora.io(13086): (00000228): AudioDeviceEventManager::CallbackOnError->CallbackOnError(this:0xb4000071fcd20840, errCode: 1166)
I/agora.io(13086): audio_device_event_handler_android.cpp: (line 71): ApplyFallbackStrategy receive error 1166

Can you please verify that UID range is incorrect ??????

### I believe this issue has to deal with Agora SDK primary camera access along with internal localAudioTrack.
Also can you please help me understand what it means by CallbackOnError errCode 1166 ??? Could not find reference

Below is only audio call logs:

I/agora.io(13086): [LAR]: NotifyTrackStateChange state: 1, errorCode: 0
I/agora.io(13086): (00000106): ChannelProxy::onLocalAudioTrackStateChanged->onLocalAudioTrackStateChanged(this:0xb40000729da328d0, state:1 errorCode:0)
I/agora.io(13086): (00000107): RtcEngineEventHandlerCallback::onLocalAudioTrackStateChanged->onLocalAudioTrackStateChanged(this:0xb40000720ccd3058, state:1 errorCode:0)
I/agora.io(13086): [LAR]: NotifyTrackStateChange state: 2, errorCode: 0
I/agora.io(13086): (00000117): ChannelProxy::onLocalAudioTrackStateChanged->onLocalAudioTrackStateChanged(this:0xb40000729da328d0, state:2 errorCode:0)
I/agora.io(13086): (00000118): RtcEngineEventHandlerCallback::onLocalAudioTrackStateChanged->onLocalAudioTrackStateChanged(this:0xb40000720ccd3058, state:2 errorCode:0)
E/agora.io(13086): [ap-6][tds] OnError to 118.******.38:8443, transport type = aut(5), error type = 4
I/agora.io(13086): (00000124): AudioDeviceEventManager::CallbackOnError->CallbackOnError(this:0xb4000071fcd3d720, errCode: 1166)
I/agora.io(13086): audio_device_event_handler_android.cpp: (line 71): ApplyFallbackStrategy receive error 1166
I/agora.io(13086): ADGM: CallbackOnError errCode 1166
I/agora.io(13086): [ASM]: CallbackOnError errCode 1166
I/agora.io(13086): [CONN-0][ch0] outgoing stream 2 is closed, error: 5, detail: session closed by local instantly
I/agora.io(13086): [CONN-0][ch0] outgoing stream 4 is closed, error: 5, detail: session closed by local instantly
I/agora.io(13086): [CONN-0][ch0] outgoing stream 6 is closed, error: 5, detail: session closed by local instantly
I/agora.io(13086): [LAR]: NotifyTrackStateChange state: 0, errorCode: 0
I/agora.io(13086): (00000149): ChannelProxy::onLocalAudioTrackStateChanged->onLocalAudioTrackStateChanged(this:0xb40000729da328d0, state:0 errorCode:0)
I/agora.io(13086): (00000150): RtcEngineEventHandlerCallback::onLocalAudioTrackStateChanged->onLocalAudioTrackStateChanged(this:0xb40000720ccd3058, state:0 errorCode:0)

Closing this thread as fixed by changing following configuration:
Behavior changes: Apps targeting Android 13 or higher

  1. Adding below in android manifest
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES"/>
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO"/>
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO"/>

Reference: https://developer.android.com/about/versions/13/behavior-changes-13

  1. LocalPreview VideoCanvas only takes local uid=0, even if local uid is dynamic in other code logic.
    Pass 0 to videocanvas.

Thank you @littleGnAl. Closing this thread as solved.

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please raise a new issue.