You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Kivy 2.3.1, the application hangs unexpectedly when attempting to play one stone by the user. After debugging for a while, this bug seems to be caused by the "play_sound" function under gui/sound.py.
There is no error or warning message, and the application becomes unresponsive.
This issue does not occur in Kivy 2.3.0, where the same code runs without issues. The problem seems to be a regression introduced in Kivy 2.3.1.
Steps to Reproduce:
Install Kivy 2.3.1: pip install kivy==2.3.1
Run the application, click once on the board and observe that the application hangs.
Roll back to Kivy 2.3.0: pip install kivy==2.3.0
Run the same code, and notice that the application works fine.
You can replace the function content of play_sound with pass to see the difference.
Expected Behavior:
The application should play the sound and remain responsive, as it does in Kivy 2.3.0.
Actual Behavior:
The application hangs without any error or warning, even using katrain -d.
Environment:
Kivy Version: 2.3.1
Python Version: Python 3.11 (I tested Python 3.12 and 3.13 as well, this issue seems have nothing to do with the Python version)
Operating System: Arch Linux x86_64 with KDE Plasma
The OS did matter, as when I manually set ranking to be: [("ffplay", 100), ("sdl", 0), ("gst", 0), ("", 0)], there are errors about FFmpeg but does not hang, when the SoundLoader uses gst, it hangs. My system installed gstreamer 1.24.10-2 and ffmpeg 2:7.1-5
I believe it shall be one bug of Kivy, but I did not dive much about that.
Suggestion:
The easiest way to fix this issue is to limit the kivy version to be under 2.3.1 in the pyproject.toml.
Or use pygame instead, I tried this approach as well and it seems to be much more stable than Kivy.
Here is the code snippet I tried:
importpygameimportosbase_dir=os.path.dirname(os.path.realpath(__file__))
defplay_sound(file, volume=1, cache=True):
try:
sound_file=os.path.join(base_dir, "..", "sounds", file)
pygame.mixer.init()
sound=pygame.mixer.Sound(sound_file)
sound.set_volume(volume)
sound.play()
exceptExceptionase:
print(f"Error playing sound with Pygame: {e}")
and it works fine.
The text was updated successfully, but these errors were encountered:
Description:
In Kivy 2.3.1, the application hangs unexpectedly when attempting to play one stone by the user. After debugging for a while, this bug seems to be caused by the "play_sound" function under
gui/sound.py
.There is no error or warning message, and the application becomes unresponsive.
This issue does not occur in Kivy 2.3.0, where the same code runs without issues. The problem seems to be a regression introduced in Kivy 2.3.1.
Steps to Reproduce:
Expected Behavior:
The application should play the sound and remain responsive, as it does in Kivy 2.3.0.
Actual Behavior:
The application hangs without any error or warning, even using
katrain -d
.Environment:
Kivy Version: 2.3.1
Python Version: Python 3.11 (I tested Python 3.12 and 3.13 as well, this issue seems have nothing to do with the Python version)
Operating System: Arch Linux x86_64 with KDE Plasma
Suggestion:
The easiest way to fix this issue is to limit the kivy version to be under 2.3.1 in the
pyproject.toml
.Or use
pygame
instead, I tried this approach as well and it seems to be much more stable than Kivy.Here is the code snippet I tried:
and it works fine.
The text was updated successfully, but these errors were encountered: