Canardoux / flutter_sound

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

[HELP] How to use the default audio device to playback? #403

Closed tgarm closed 3 years ago

tgarm commented 4 years ago

I need Help for Using the API.

For instance:

Play audio to default device

In FlutterSoundPlayer.openAudioSession, the argument "device" can be set to airPlay, headset, speaker, etc. But there is no device as "default".

So, if the audio session started without headset, and when playing, user plug-in the headset, the sound is still playing on speakers, not the headset. (User normally expect the output to switch to headset immediately)

Is there anyway to solve it?

Larpoux commented 4 years ago

Which OS ?

tgarm commented 4 years ago

Android. The testing device runs Android 8.1

Larpoux commented 4 years ago

Sorry for the delay to answer, @tgarm

I think that you must specify blueToothA2DP as one of your audio flags if your headset is bluetooth. When the user will plug his BlueTooth headset, i guess that the sound will be switched to the headset (probably ;-) )

I agree that this area is a little messy in Flutter Sound. Someone should clean this.

maxkrieger commented 2 years ago

For me, what fixed it was opening the recorder's audio session before the player's, if you use both.