8000 Exception in startRecordToFile() when it is invoked with a null audio channel on Android · Issue #409 · flutter-webrtc/flutter-webrtc · GitHub
[go: up one dir, main page]

Skip to content

Exception in startRecordToFile() when it is invoked with a null audio channel on Android #409

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
admarwick opened this issue Nov 10, 2020 · 0 comments · Fixed by #410
Closed

Comments

@admarwick
Copy link
Contributor

Describe the bug

A call on Android to MediaRecorder.start with a file path and a video track but a null audio channel causes an exception to be thrown:

D/FlutterWebRTCPlugin: startRecordToFile(): Attempt to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference

The bug is in MessageCallHandlerImpl.onMethodCall, case “startRecordToFile” where the code checks
for the presence of the key “audioChannel” but doesn't check if the value is null. The fix is to add that check.

To Reproduce

  1. Make a local copy of the flutter-rtc repo by forking it on Github and cloning the fork.
  2. Fix up the example so that it can run on Android 10 by adding a foreground service: add the plugin flutter_foreground_plugin and make the necessary changes to the example's AndroidManifest; then add code in main.dart to create and run the foreground service.
  3. In the example, select the first sample “GetUserMedia”.
  4. Run the sample with the FAB.
  5. Start recording with the circular icon on the app bar.
  6. See the exception in the log.

Expected behavior
No exception, a file with mp4 video should be written when the stop button is pressed.

Platform information

  • Flutter version:
flutter doctor -v
[✓] Flutter (Channel dev, 1.24.0-7.0.pre, on Mac OS X 10.15.7 19H2 darwin-x64, locale en-US)
    • Flutter version 1.24.0-7.0.pre at /users/alan/Documents/util/flutter
    • Framework revision a0860f6e87 (12 days ago), 2020-10-29 20:07:34 -0700
    • Engine revision 073263e39d
    • Dart version 2.11.0 (build 2.11.0-260.0.dev)

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /Users/alan/Library/Android/sdk
    • Platform android-30, build-tools 29.0.2
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 12.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.1, Build version 12A7403
    • CocoaPods version 1.8.4

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.0)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 50.0.1
    • Dart plugin version 193.7547
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[✓] IntelliJ IDEA Community Edition (version 2020.1.3)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin version 201.8538.45

[✓] VS Code (version 1.47.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (4 available)
    • SM G960U1 (mobile) • 243482e51b017ece • android-arm64  • Android 10 (API 29)
    • macOS (desktop)    • macos            • darwin-x64     • Mac OS X 10.15.7 19H2 darwin-x64
    • Web Server (web)   • web-server       • web-javascript • Flutter Tools
    • Chrome (web)       • chrome           • web-javascript • Google Chrome 86.0.4240.183

• No issues found!

  • Plugin version: 0.4.0
  • OS: Android
  • OS version: 10_0015
admarwick pushed a commit to admarwick/flutter-webrtc that referenced this issue Nov 11, 2020
… example to run on Android 10.

- Fix [Issue flutter-webrtc#409](flutter-webrtc#409) by adding a null guard
to `com.cloudwebrtc.webrtc/MedhodCallHandler.java`, case "startRecordToFile".
- Update the example project with the ForegroundService needed to run it on Android 10.
admarwick pushed a commit to admarwick/flutter-webrtc that referenced this issue Nov 11, 2020
admarwick pushed a commit to admarwick/flutter-webrtc that referenced this issue Nov 12, 2020
cloudwebrtc pushed a commit that referenced this issue Nov 12, 2020
…oid 10. (#410)

* Fixes [Issue #409](#409), and updates the example to run on Android 10.

- Fix [Issue #409](#409) by adding a null guard
to `com.cloudwebrtc.webrtc/MedhodCallHandler.java`, case "startRecordToFile".
- Update the example project with the ForegroundService needed to run it on Android 10.

* fixup! Fixes [Issue #409](#409), and updates the example to run on Android 10.

* fixup! Fixes [Issue #409](#409), and updates the example to run on Android 10.

Co-authored-by: Alan Marwick <admarwick@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant
0