Play a sound
#1
is there anyway to play a .wav file with python. one of the navigation sounds.

what i want to do is, if music is playing pause the playback, play a sound (wav file) and then start the music playback again.

the only way i can think of is to let the script control a playlist. stop the playlist, play an mp3, then restart the playlist, i guess from the begining.

thanks
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#2
in case anybody wanted to know. you can use xbmc.player().play(file) and when that file is done playing, your playlist or the folder your playing continues. Smile

but i have a weird problem, when activating the visualisation window. i have to call a xbmc.player() command (playnext(), playprevious(), play(), pause()) or else my only visible control on the dialog loses focus and a setfocus will not work. play() messes up the playlist since i play an alert.mp3, i don't want to skip the currently playing song, so i use two pause()'s.

should the setfocus work or is there a better way than how i'm doing it?

thanks.

Quote:def starttimer(self):
   if xbmc.player().isplayingaudio():
       if self.music_playing:
           xbmc.executebuiltin('xbmc.activatewindow(2006)')
       if self.music_playing and xbmc.player().getplayingfile() == alarmfile:
           xbmc.player().playnext()
       elif xbmc.player().getplayingfile() == alarmfile:
           xbmc.player().stop()
       else:
           xbmc.player().pause()
           xbmc.player().pause()
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#3
in case for future reference a simple sleep(.05) before the setfocus() did the trick.

Quote:else:
sleep(.05)
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply

Logout Mark Read Team Forum Stats Members Help
Play a sound0