Canardoux / flutter_sound

Flutter plugin for sound. Audio recorder and player.
Mozilla Public License 2.0
877 stars 573 forks source link

[BUG] iOS record always use bluetooth headset, can't change it to use iPhone #342

Closed JayTam closed 4 years ago

JayTam commented 4 years ago

Flutter Sound Version :

Severity


Platforms you faced the error

I only test by iOS real device


flutter pub deps :

dependencies:
  flutter:
    sdk: flutter

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^0.1.2
  flutter_blue: 0.7.2
  flutter_sound: ^4.0.0
  gradient_app_bar: ^0.1.3
  dio: 3.0.9
  uuid: 2.0.4
  rxdart: 0.24.0
  provider: 4.0.4
  sqflite: 1.3.0
  fluttertoast: ^4.0.0
  pull_to_refresh: ^1.5.7
  flutter_incall_manager:
    git:
      url: https://github.com/JayTam/flutter-incall-manager

Screenshots

image

image


Describe the bug

I connect a bluetooth headset named TOFO, but I still wanna record use iPhone. I enter iOS Audio Manager to change audio device from TOFO to iPhone in the picture above, then I call recorderModule.startRecorder() to record, it still record by TOFO, is these a bug ?

To Reproduce

  1. use iPhone connect a bluetooth headset
  2. enter iOS Audio Manager to change audio device from bluetooth headset to iPhone
  3. use flutter_sound to record
  4. it still record by bluetooth headset

Expected behavior


Larpoux commented 4 years ago

Yes, there is actually something missing in Flutter Sound. Actually there is a parameter to specify the audio input on Android, but this is not OS independent. We must do something to fix that in next version.

JayTam commented 4 years ago

Yes, there is actually something missing in Flutter Sound. Actually there is a parameter to specify the audio input on Android, but this is not OS independent. We must do something to fix that in next version.

Looking forward to your fix, thanks for your work 👍👍

JayTam commented 4 years ago

Fixed the bug in #372

Before player/recorder start, you can switch AudioDevice by call setAudioFocus(device: xxx)

playerModule.setAudioFocus(device: AudioDevice.bluetooth);
recorderModule.setAudioFocus(device: AudioDevice.speaker);