Note that there are some explanatory texts on larger screens.

plurals
  1. POKivy: Sound starts to play, but is 'unstoppable' on Android, but on Windows it works
    primarykey
    data
    text
    <p>I got a series of ToggleButtons in kivy, with each loaded a different soundfile.</p> <p>When i try my Code in Windows, everything works as expected, but on Android via the Kivy Launcher, the sound doesn't get stopped.</p> <pre><code>class AudioButton(ToggleButton): sound = ObjectProperty(None) def killsound(self, state, dt): self.sound.stop() if 'Click to stop' in self.text: self.text = self.text.strip('\nClick to stop') self.height = 60 else: pass def on_press(self): self.bind(state=self.killsound) if self.state == 'normal': self.sound.stop() else: self.sound.play() self.text = self.text+'\nClick to stop' self.height=240 </code></pre> <p>Here's what it does / should do:</p> <ul> <li>Create an <code>AudioButton</code> instance with previously specified soundfile (also specified: <code>size_hint</code>, <code>font_size</code> and <code>group</code>(to act as radio buttons)</li> <li><code>on_press</code> fires the callback <code>killsound</code> when the state of the Button changes</li> <li>When the Button is <code>state=='down'</code> the sound plays, and the Text of the Button gets a Caption appended</li> <li>If the Button is <code>state=='normal'</code> it stops the currently playing sound, if the concerning Button gets pressed, if another Button gets pressed, theres the Callback:</li> </ul> <p>Callback(killsound):</p> <ul> <li>directly stops the sound when state changes</li> <li>removes previously added Caption and resizes the Button</li> </ul> <p>On Windows, everything works fine with this code. On Android however, when the <code>killsound</code> 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.</p> <p>Can you help me?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload