title: How can I get Kivy to use sdl2 on Linux?
body: <p>I've got a problem where Kivy uses sdl2 on android, and works fine, but on linux it uses ffpyplayer, which doesn't.</p>
  
  <p>So I'd like to get Kivy to use sdl2 on linux too, however sdl2 doesn't seem to work at all on linux.</p>
  
  <pre><code>$ KIVY_AUDIO=sdl2 python min_audio_example.py 
  
  [INFO   ] [Audio       ] Providers: audio_sdl2 (audio_ffpyplayer ignored)
  [CRITICAL] [AudioSDL2   ] Unable to open mixer: b'No such audio device'
  </code></pre>
  
  <p>Here's a minimal example with demonstrates the problem.</p>
  
  <pre><code>#!/usr/bin/env python
  
  # works with:
  # export KIVY_AUDIO=ffpyplayer
  # fails with:
  # export KIVY_AUDIO=sdl2
  
  from kivy.app import App 
  
  from kivy.core.audio import SoundLoader
  
  def playsound(dummy):
      sound = SoundLoader.load("440Hz_44100Hz_16bit_05sec.ogg")
  
      if sound:
          print("Sound found at %s" % sound.source)
          print("Sound is %.3f seconds" % sound.length)
          print("sound state", sound.state)
          sound.play()
          print("sound state", sound.state)
          import time
          time.sleep(5)
  
  class TestApp(App):
      playsound(None)
  
  
  
  
  if __name__ == '__main__':
      TestApp().run()
  </code></pre>
  
  <p>I think it might be something to do with how the kivy wheel is built, so I tried </p>
  
  <pre><code>pip uninstall kivy
  pip install -U --no-binary=:all: kivy
  </code></pre>
  
  <p>At that point, kivy doesn't seem to see sdl2 at all!</p>
  
  <pre><code>$ KIVY_AUDIO=sdl2 python min_audio_example.py
  
  
  [INFO   ] [Audio       ] Providers:  (audio_ffpyplayer, audio_pygame ignored)
  [WARNING] [Audio       ] Unable to find a loader for &lt;/home/john/data/sight-sing/sightsinger/440Hz1secfadeinandout.ogg&gt;
  </code></pre>
  
  <p>It's now listing audio_ffpyplayer, and audio_pygame as providers, and not using either because of the environment variable. (The pygame provider also seems broken, but ffpyplayer still works)</p>
  
  <p>Can anyone help?</p>