how to play sound when open dialog window
#1
I have this python script to open a dialog OK box, I want to play sound in my file when the dialog box open
Quote:if now == remind:
dialog = xbmcgui.Dialog() dialog.ok('reminder box', 'don't forget')
time.sleep(55)
xbmcaddon.Addon('script.remideme')
import script2

how can I play the sound with dialog OK?
Reply
#2
xbmc.playSFX()
https://codedocs.xyz/xbmc/xbmc/group__py...e69784e2b9
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#3
I tried it like this but didn't play any thing! and didn't show any error in logs!

   xbmc.playSFX('special://xbmc/addons/script.remideme/remind.wav')

is there any special properties for wav file?
Reply
#4
perhaps that path isn't valid?
it points to kodi's system addons, not the user installed addons.

to get the path to your addon, the standard way would be to use the getAddonInfo() function
https://codedocs.xyz/xbmc/xbmc/group__py...3a8a4222fb
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#5
I am sure about the path because I test it as execute python script with the same path for audio file!
Reply
#6
Is there any lib or mod I need to import it?

all these I imported

import xbmc, xbmcaddon, xbmcgui, xbmcplugin
import os
import time

enough?
Reply
#7
Ooops..yes it's related to the path...now it works..many thanks
Reply

Logout Mark Read Team Forum Stats Members Help
how to play sound when open dialog window0