title: Flutter app's audio not working through speaker
body: <p>I am having trouble getting my flutter app to play audio through iOS speakers. I have tried on multiple iOS devices. The audio plays through android speakers, android headphones, and iOS headphones. I get no error messages about it, and the audio seems to be playing based on the log messages showing the position of the audio file changing. </p>
  
  <p>I am using the package audioplayer
  (<a href="https://pub.dartlang.org/packages/audioplayer" rel="nofollow noreferrer">https://pub.dartlang.org/packages/audioplayer</a>)</p>
  
  <p>I have even tried running the example (<a href="https://pub.dartlang.org/packages/audioplayer#-example-tab-" rel="nofollow noreferrer">https://pub.dartlang.org/packages/audioplayer#-example-tab-</a>), and I get the same issue. </p>
  
  <p>I have also tried using the package audioplayers (<a href="https://pub.dartlang.org/packages/audioplayers" rel="nofollow noreferrer">https://pub.dartlang.org/packages/audioplayers</a>). Same thing. If anyone can point me towards any explanation... I suppose I need to default to the speakers somehow, but I can't find any documentation on how to do that in flutter, and I haven't yet learned how to override certain aspects of a flutter app with native swift/objective c code. If anyone has any suggestions, I'd love to hear them.</p>
  
  <p>Attached are logs with and without the headphones plugged in to my iPhone.</p>
  
  <p>With headphones:</p>
  
  <pre><code>flutter: attempting to play /var/mobile/Containers/Data/Application/1A17D73F-0130-4A6B-A1F4-B44ECAB4EF3E/Documents/English_mit_filler_David.mp3
  iOS =&gt; call play
  iOS =&gt; playerId dd4d9d29-2188-4795-abfb-6d785c6c19a7
  play!
  isLocal: 1 1
  volume: 1.000000 1
  togglePlay /var/mobile/Containers/Data/Application/1A17D73F-0130-4A6B-A1F4-B44ECAB4EF3E/Documents/English_mit_filler_David.mp3
  ios -&gt; updateDuration...nan
  ios -&gt; onTimeInterval...
  flutter: _AudioAppState.setPositionHandler =&gt; p 0:00:00.000000
  ios -&gt; onTimeInterval...
  player status: 1
  ios -&gt; updateDuration...19.435102
  ios -&gt; invokechannel
  flutter: _AudioAppState.setPositionHandler =&gt; p 0:00:00.000000
  ios -&gt; onTimeInterval...
  ios -&gt; onTimeInterval...
  flutter: _AudioAppState.setDurationHandler =&gt; d 0:00:19.435000
  flutter: _AudioAppState.setPositionHandler =&gt; p 0:00:00.000000
  flutter: _AudioAppState.setPositionHandler =&gt; p 0:00:00.000000
  ios -&gt; onTimeInterval...
  flutter: _AudioAppState.setPositionHandler =&gt; p 0:00:00.200000
  ios -&gt; onTimeInterval...
  flutter: _AudioAppState.setPositionHandler =&gt; p 0:00:00.401000
  ios -&gt; onTimeInterval...
  flutter: _AudioAppState.setPositionHandler =&gt; p 0:00:00.600000
  ios -&gt; onTimeInterval...
  </code></pre>
  
  <p>Without headphones:</p>
  
  <pre><code>flutter: attempting to play /var/mobile/Containers/Data/Application/1A17D73F-0130-4A6B-A1F4-B44ECAB4EF3E/Documents/English_mit_filler_Dropbox.mp3
  iOS =&gt; call play
  iOS =&gt; playerId 60dc6e8c-4619-4abb-812d-33dcb03f23a8
  play!
  isLocal: 1 1
  volume: 1.000000 1
  togglePlay /var/mobile/Containers/Data/Application/1A17D73F-0130-4A6B-A1F4-B44ECAB4EF3E/Documents/English_mit_filler_Dropbox.mp3
  ios -&gt; updateDuration...nan
  ios -&gt; onTimeInterval...
  ios -&gt; onTimeInterval...
  ios -&gt; onTimeInterval...
  flutter: _AudioAppState.setPositionHandler =&gt; p 0:00:00.000000
  player status: 1
  ios -&gt; updateDuration...28.682449
  ios -&gt; invokechannel
  flutter: _AudioAppState.setPositionHandler =&gt; p 0:00:00.000000
  flutter: _AudioAppState.setPositionHandler =&gt; p 0:00:00.000000
  flutter: _AudioAppState.setDurationHandler =&gt; d 0:00:28.682000
  ios -&gt; onTimeInterval...
  ios -&gt; onTimeInterval...
  flutter: _AudioAppState.setPositionHandler =&gt; p 0:00:00.000000
  flutter: _AudioAppState.setPositionHandler =&gt; p 0:00:00.000000
  ios -&gt; onTimeInterval...
  flutter: _AudioAppState.setPositionHandler =&gt; p 0:00:00.201000
  ios -&gt; onTimeInterval...
  flutter: _AudioAppState.setPositionHandler =&gt; p 0:00:00.401000
  ios -&gt; onTimeInterval...
  flutter: _AudioAppState.setPositionHandler =&gt; p 0:00:00.601000
  ios -&gt; onTimeInterval...
  </code></pre>
  
  <p>Looks like the same logs to me, with no errors on either end. But it's like the sound is muted- and I've made sure that do not disturb mode is not on, silent mode is not on, I've checked button on the mute button on the side of the phone is not on... I have tried it on the emulator through Xcode and then the audio did play... But I can't figure out how to get it to work on my physical devices.
  Thanks for any advice!</p>