videosdk-live / videosdk-rtc-flutter-sdk-example

WebRTC based video conferencing SDK for Flutter (Android / iOS)
https://docs.videosdk.live/flutter/guide/video-and-audio-calling-api-sdk/getting-started
81 stars 30 forks source link

VideoSDK Crashes on iOS 16.4 Simulator and Samsung S8+ Android 9 with NullPointerException #48

Closed huantd0111 closed 3 months ago

huantd0111 commented 1 year ago

The VideoSDK continues to experience operational failures on both the iOS 16.4 Simulator and the Samsung S8+ running Android 9. A crash persists while attempting to use the VideoSDK, yielding a NullPointerException within the logs. This issue might be correlated with Flutter WebRTC integration, as indicated by the following URL: https://github.com/flutter-webrtc/flutter-webrtc/issues/1365.

Steps to Reproduce:

  1. Install VideoSDK version 1.1.5.
  2. Launch the iOS 16.4 Simulator or use a Samsung S8+ device with Android 9.
  3. Integrate the VideoSDK into a sample application or use an existing application that employs the SDK's video functionality.
  4. Attempt to initiate video playback or recording.

Expected Behavior: VideoSDK should successfully initialize and execute video-related functions on both iOS 16.4 Simulator and Samsung S8+ Android 9 devices.

E/AndroidRuntime(10644): java.lang.NullPointerException: Attempt to invoke interface method 'void org.webrtc.VideoCapturer.initialize(org.webrtc.SurfaceTextureHelper, android.content.Context, org.webrtc.CapturerObserver)' on a null object reference
E/AndroidRuntime(10644):    at com.cloudwebrtc.webrtc.GetUserMediaImpl.getUserVideo(GetUserMediaImpl.java:730)
E/AndroidRuntime(10644):    at com.cloudwebrtc.webrtc.GetUserMediaImpl.getUserMedia(GetUserMediaImpl.java:597)
E/AndroidRuntime(10644):    at com.cloudwebrtc.webrtc.GetUserMediaImpl.access$000(GetUserMediaImpl.java:84)
E/AndroidRuntime(10644):    at com.cloudwebrtc.webrtc.GetUserMediaImpl$1.invoke(GetUserMediaImpl.java:456)
E/AndroidRuntime(10644):    at com.cloudwebrtc.webrtc.GetUserMediaImpl.lambda$requestPermissions$1(GetUserMediaImpl.java:849)
E/AndroidRuntime(10644):    at com.cloudwebrtc.webrtc.GetUserMediaImpl$$ExternalSyntheticLambda0.invoke(Unknown Source:6)
E/AndroidRuntime(10644):    at com.cloudwebrtc.webrtc.utils.PermissionUtils$1.onReceiveResult(PermissionUtils.java:115)
E/AndroidRuntime(10644):    at android.os.ResultReceiver$MyRunnable.run(ResultReceiver.java:50)
E/AndroidRuntime(10644):    at android.os.Handler.handleCallback(Handler.java:873)
E/AndroidRuntime(10644):    at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(10644):    at android.os.Looper.loop(Looper.java:214)
E/AndroidRuntime(10644):    at android.app.ActivityThread.main(ActivityThread.java:7050)
E/AndroidRuntime(10644):    at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(10644):    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
E/AndroidRuntime(10644):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965)

Environment:

Steps Taken So Far:

  1. Verified the issue by replicating it on both platforms.
  2. Tested the provided example application using VideoSDK version 1.1.5.
  3. Investigated the error logs for insights into the root cause.
  4. Noted the resemblance between this issue and the one outlined at https://github.com/flutter-webrtc/flutter-webrtc/issues/1365.

Expected Impact: This issue impedes the effective utilization of VideoSDK features on iOS 16.4 Simulator and Samsung S8+ Android 9 devices, adversely affecting developers and users who depend on the SDK's functionality. It is imperative to address this issue promptly to uphold a seamless user experience.

Note: This issue report aims to spotlight the concern and foster collaboration among the developer community to identify and rectify the underlying issue. If you have encountered this issue or possess relevant insights, please contribute to the ongoing discussion. Additionally, the potential connection to the Flutter WebRTC issue https://github.com/flutter-webrtc/flutter-webrtc/issues/1365 could offer a valuable avenue of investigation.

ishabodiwala commented 1 year ago

Hey @huantd0111, are you using customTrack for video?

huantd0111 commented 1 year ago

Hi @ishabodiwala ,

I'd like to provide some additional information to further clarify the situation. As I previously mentioned, I am not using the CustomTrack feature within my application.

To provide more context, my application was functioning perfectly prior to the update to version 1.1.5. I had tested it extensively on various devices and even on simulators, and there were no issues. The stable performance was observed consistently across different platforms.

However, the problem emerged immediately after I upgraded to version 1.1.5. This leads me to believe that the issue is tied to this specific update.

In an attempt to isolate the problem, I tested the sample application provided by your team. Regrettably, the same issue surfaced even within the example application, indicating that it is not confined to my custom implementation.

Given these details, it's clear that the issue is not stemming from my application code, but rather from the changes introduced in version 1.1.5 of the SDK.

I kindly request your assistance in investigating this matter further. If there's any additional information you require from me, or if you need me to perform any specific tests, please don't hesitate to let me know. Your expertise and support in resolving this issue are greatly appreciated.

Thank you for your understanding and collaboration.

ishabodiwala commented 1 year ago

@huantd0111, give us some time to look into it. Meanwhile can you test it with customTrack ?

ishabodiwala commented 1 year ago

Hey @huantd0111, We've tested the app on a Redmi 6A running Android version 9, but we haven't been able to replicate the issue you mentioned. Also, can you share error which you have faced on iOS simulator?

huantd0111 commented 1 year ago

@ishabodiwala I initiated a meeting on the Simulator, specifically with the meeting ID "9g87-qgsu-gffw," and encountered an issue. The error details are provided in the log snippet below:

[log] Device List: 2 audioinput audiooutput [log] Unable to set default media device RangeError (index): Invalid value: Valid value range is empty: 1 [log] videosdk-client:Device load() [routerRtpCapabilities:Instance of 'RtpCapabilities'] [log] videosdk-client:Plan B handler getNativeRtpCapabilities() [log] videosdk-client:Device load() | got native RTP capabilities:Instance of 'RtpCapabilities' flutter: generateProfileLevelIdForAnswer() | result: [profile:1, level:51 [log] videosdk-client:Device load() | got extended RTP capabilities:Instance of 'ExtendedRtpCapabilities' [log] videosdk-client:Device load() | got receiving RTP capabilities:Instance of 'RtpCapabilities' [log] videosdk-client:Plan B handler getNativeSctpCapabilities() [log] videosdk-client:Device load() | got native SCTP capabilities:Instance of 'SctpCapabilities' [log] videosdk-client:Device load() successed [log] videosdk-client:Plan B handler close() [log] Send Transport true [log] videosdk-client:Device createSendTransport() [log] videosdk-client:Transport constructor() [id:7ce8b1c1-751f-4e48-b145-350ab02f9bac, direction:send] [log] videosdk-client:Plan B handler run() [log] videosdk-client:Device createRecvTransport() [log] videosdk-client:Transport constructor() [id:54e08649-a22b-4841-8a54-516374fdf9d5, direction:recv] [log] videosdk-client:Plan B handler run() flutter: VideoCall-Debug: VideoCallView::roomLeft null flutter: VideoCall-Debug: VideoCallView::closeCallScreen /booking_doctor [log] videosdk-client:Transport produce() [track:Track(id: E794CE0D-F66A-4CC0-9E64-DADEADAEF458, kind: audio, label: E794CE0D-F66A-4CC0-9E64-DADEADAEF458, enabled: true, muted: false) [log] videosdk-client:Plan B handler send() [kind:audio, track.id:E794CE0D-F66A-4CC0-9E64-DADEADAEF458] [log] Null check operator used on a null value [log] videosdk-client:Transport close() [log] videosdk-client:Plan B handler close() [log] videosdk-client:Transport close() [log] videosdk-client:Plan B handler close() [log] videosdk-client:Transport connection state changed to closed [log] videosdk-client:Transport connection state changed to closed [log] Unable to RTCPeerConnection::createOffer: Error: peerConnection not found! [log] #0 Transport._produce (package:videosdk/src/core/webrtc/src/transport.dart:929:7)

#1 FlexQueue._runTask (package:videosdk/src/core/webrtc/src/FlexQueue/flex_queue.dart:88:28)

Please review the log for more insights into the encountered error. Let me know if you need further assistance or information regarding this issue.

ishabodiwala commented 1 year ago

Hey @huantd0111,The issue you faced is a result of the iOS simulator lacking camera functionality. To properly test the camera-related features, you'll need to use an actual device. If you want to use the iOS simulator for testing, you can disable the camera when initiated a meeting.

huantd0111 commented 1 year ago

@ishabodiwala I agree with you. However, there is an issue at hand. In the previous version, I could still initiate a video call on the simulator even though the camera functionality was not operational. But in the current version, I'm unable to initiate a meeting, and it immediately receives the "Events.roomLeft" signal. I believe this issue should also be addressed in the upcoming version.

One potential solution for the next version could be to allow the initiation of a call on the simulator but automatically set "camEnabled" to false, given the absence of camera functionality. This would provide a more consistent testing experience and prevent the "Events.roomLeft" issue.

Let me know your thoughts on this approach or if you have any other suggestions to handle this situation.

huantd0111 commented 1 year ago

Hey @huantd0111, We've tested the app on a Redmi 6A running Android version 9, but we haven't been able to replicate the issue you mentioned. Also, can you share error which you have faced on iOS simulator?

I'm currently testing on a Samsung S8 Plus running Android 9. I believe the issue might stem from our previous attempts to address bugs for devices from China with lower iOS versions like Redmi, Xiaomi, or Huawei, specifically related to the CustomTrack object.

However, after reverting back to the previous version, 1.1.4, I still encounter a similar issue, even though I had successfully tested on this version and device before. Could it be related to a cache problem with the Flutter library and flutter-webrtc/dart_webrtc? Upon checking my log file, I see that flutter-webrtc is using version 0.9.34 and dart_webrtc is using version 1.0.17.

Do you have any other suggestions? It's worth noting that when I fixed the issue using CustomTrack in the past, it caused errors for devices that were previously unaffected. Your insights or recommendations would be greatly appreciated.

ishabodiwala commented 1 year ago

Hey @huantd0111, please try following steps and let us know the result.

  1. Run flutter clean
  2. delete pubspec.lock file.
  3. change sdk version to 1.1.3
  4. Run flutter pub get
  5. test on Samsung S8 Plus device
huantd0111 commented 1 year ago

Hey @huantd0111, please try following steps and let us know the result.

  1. Run flutter clean
  2. delete pubspec.lock file.
  3. change sdk version to 1.1.3
  4. Run flutter pub get
  5. test on Samsung S8 Plus device

Hey @ishabodiwala . I had tried it before, and version 1.1.3 worked well on my device (S8 Plus, Android 9). However, this version previously encountered issues with Xiaomi and Redmi devices running on Android versions earlier than 9.0. Specifically, I had reported this matter in the issue raised at https://github.com/videosdk-live/videosdk-rtc-flutter-sdk-example/issues/46. Additionally, with version 1.1.3, there's an problem regarding toggling the microphone during calls. Therefore, it's advisable for us to address these concerns in the latest version currently available, which is 1.1.5.

ishabodiwala commented 1 year ago

Hey @huantd0111, we apologise for any inconvenience, but we are currently unable to replicate this issue. Our testing encompassed Redmi 6A (operating on Android 9), as well as emulators running on Android 7.1.1 and 9. We would like to inquire if it would be feasible to arrange a collaborative testing effort to address this matter? Your insights and collaboration would be greatly appreciated.

huantd0111 commented 1 year ago

@ishabodiwala Thank you for reaching out. We appreciate your efforts in investigating the issue. Sure, we can certainly arrange a testing session on my device using TeamViewer. We can coordinate the timing for this directly through Discord. I will have a sample project ready, along with the required environment setup and device connectivity. This way, you can easily debug on my machine. Looking forward to collaborating closely to resolve this matter.

ishabodiwala commented 1 year ago

@huantd0111, Certainly, we're grateful for your engagement in addressing the issue. A testing session on your device through TeamViewer sounds great. Coordinating via Discord works well. Please join our community and raise the issue there so we can coordinate the timing. Let's collaborate closely to resolve this. Thank you for your proactive involvement.

You can join our discord community from here.

ishabodiwala commented 1 year ago

Hey @huantd0111