Play sound on button press?
#1
I would like to play a navigation sound each time the "browser_home" key is pressed. Is there any way to do this via skinning? I know I can put it into the global keymap (via userdata/keyboard.xml or /usr/share/xbmc/system/keymaps/keyboard.xml) but I can't imagine asking everyone who installs my skin to modify their keymaps. I was expecting there to be a keyboard.xml inside the skin folder, but I haven't seen how to do that.
EDIT: I also know I could add it to sounds.xml in the <activate> of the "home" window - but that plays the sound every time I enter the home screen. I just want to play the sound when the browser_home key is pressed.
Reply
#2
Check the skin's 'sounds' folder.

There's no Home button sound though you'll have to use 'parentdir' I guess.
Reply
#3
Thanks for the suggestion Hitcher, unfortunately that doesn't work. parentdir is not the same as "activate the Home screen". I've been looking at it in detail, and the sound interface really is just too limited to do what I want. All it can do is play a sound whenever a window is activated. What I need is to play a sound conditionally when a window is activated.
I can see two ways of doing it - both of them require code changes. I'm not sure which design would be best.
1. Add some conditional values to sounds.xml. For my particular case, I'd like to know the "reason" the window was activated (e.g. Startup, Home button pressed, Back button pressed ..). A conditional that just checked the value of a skin setting would also work. I could set the value, activate the window, then clear the value.
2. In addition to the <window> and <action> tags in sounds.xml, add a <name> tag. The name tag allows you to define a name for a sound. Then, we could add an action called PlaySound and could do something like this in our skin:
Code:
<onleft>PlaySound(mySoundName)</onleft>

Method two is a little more manual, but I think it's the one I like best. Anyone have any feedback? Has anyone else run into skinning issues due to the limited navigation sound interface?
Reply
#4
you could put a setproperty(playsound,true,home) in keymaps before the window call (are several commands for one button allowed in keymaps?) and then use

<onload condition="!Player.HasMedia + !IsEmpty(Window(home).property(playsound))">Playmedia(...)</onload>
and clear that property afterwards.
would need a bit more adjusting in other areas to avoid that the nowplaying widgets do not show up when playin that specific sound file.

that´s only a dirty workaround though, i agree that the sound interface is rather limited for skinners.
Donate: https://kodi.tv/contribute/donate (foundation), 146Gr48FqHM7TPB9q33HHv6uWpgQqdz1yk (BTC personal)
Estuary: Kodis new default skin - ExtendedInfo Script - KodiDevKit
Reply
#5
@teaguecl
I must say I don't really like mixing sounds handling with gui in window/dialog .xml . Could you explain why do You want play GUI sound only with that particular key? Maybe after I'll get it I may be able to assist You on this one. Wink
Always read the XBMC online-manual, FAQ and search the forums before posting.
Do NOT e-mail Team-XBMC members asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting, make sure you read this first

My previous forum/trac nickname: grajen3
Reply

Logout Mark Read Team Forum Stats Members Help
Play sound on button press?0