Kodi Community Forum

Full Version: playSFX dont work
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

I try to use "playSFX" to play a soundfile. But no matter what I do, it doesn't work Confused

Here is the Code:
python:

import xbmcgui
import xbmc
xbmc.playSFX('special://home/addons/script.hello.world/resources/wavs/set_ok.wav',True)
xbmc.playSFX('special://xbmc/addons/script.hello.world/resources/wavs/set_ok.wav',True)
xbmc.playSFX('/home/pi/.kodi/addons/script.hello.world/resources/wavs/set_ok.wav',True)
xbmcgui.Dialog().notification("Check", "Done", xbmcgui.NOTIFICATION_INFO, 2000)

The wave-file is an place:

Image

There is no error when executing the addon- But also no sound ;(

Whats wrong?
1 there's no need to hardcode the path
python:
import xbmc
import xbmcaddon
import os

path = xbmcaddon.Addon().getAddonInfo('path')
sndfile = os.path.join(path, 'resources', 'wavs', 'set_ok.wav')

xbmc.playSFX(sndfile, True)

2 this settings needs to be enabled:
settings > system > audio > play gui sounds
(2020-03-13, 18:48)ronie Wrote: [ -> ]1 there's no need to hardcode the path

2 this settings needs to be enabled:
settings > system > audio > play gui sounds

1) I know. But when it doesnt work, you try everything Wink
2) cant find somthing like that in der german version:

Image
Image
OK, I got it. It was THIS.
Image

Now it works. THANK YOU!