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

@admarwick

Description

@admarwick

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0