Kivy: Sound starts to play, but is 'unstoppable' on Android, but on Windows it works

I got a series of ToggleButtons in kivy, with each loaded a different soundfile.

When i try my Code in Windows, everything works as expected, but on Android via the Kivy Launcher, the sound doesn't get stopped.

class AudioButton(ToggleButton):
    sound = ObjectProperty(None)

    def killsound(self, state, dt):
        if 'Click to stop' in self.text:
            self.text = self.text.strip('\nClick to stop')
            self.height = 60

    def on_press(self):
        if self.state == 'normal':
            self.text = self.text+'\nClick to stop'

Here's what it does / should do:

  • Create an AudioButton instance with previously specified soundfile (also specified: size_hint, font_size and group(to act as radio buttons)
  • on_press fires the callback killsound when the state of the Button changes
  • When the Button is state=='down' the sound plays, and the Text of the Button gets a Caption appended
  • If the Button is state=='normal' it stops the currently playing sound, if the concerning Button gets pressed, if another Button gets pressed, theres the Callback:


  • directly stops the sound when state changes
  • removes previously added Caption and resizes the Button

On Windows, everything works fine with this code. On Android however, when the killsound get's called, it removes the caption and resizes the Button, but it won't stop the sound - The old sound (which should be stopped) is still playing, the new one starts, so I got both sound playing at the same time, same with more than two sounds.

Can you help me?


This have been fixed in Kivy 1.4.1. You should talk to us via mailing list, or report a github issue instead of posting here :)

Need Your Help

iOS: How to distinguish between iPhone mode and iPad mode?

ios iphone objective-c ipad

I'm building an universal iOS app and some config variables have different value between iPhone mode and iPad mode. Please notice that I said the Mode word.

Error passing vertices to shader

android opengl-es glsl opengl-es-2.0 vertex-shader

I'm beginning simple 2d gles 2.0 android application.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.