Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Contributor
Posts: 41
Registered: ‎10-16-2012
My Device: Bold 9000
Accepted Solution

Play system sound from qml

How can I play a simple keyboard click sound from qml.  My app has a ton of buttons and I would like them to make a click sound and possibly vibrate the phone for feedback.

Contributor
Posts: 41
Registered: ‎10-16-2012
My Device: Bold 9000

Re: Play system sound from qml

Got most of it figured out.

 

Add the import to the qml...

 

import bb.multimedia 1.0

 

Create the attached object...

    attachedObjects: 
    [
       SystemSound
       {
           id: sysSound
           sound: SystemSound.CameraShutterEvent
       }
   ]

 And then play it...

 

sysSound.play() 

 

Still not sure where to find a list of system sounds though.

Contributor
Posts: 41
Registered: ‎10-16-2012
My Device: Bold 9000

Re: Play system sound from qml

Found it.  Here's a list of the sounds I found.

       SystemSound
       {
           id: sysSound
           //sound: SystemSound.CameraShutterEvent
           //sound: SystemSound.BrowserStartEvent
           //sound: SystemSound.DeviceTetherEvent
           //sound: SystemSound.GeneralNotification
           sound: SystemSound.InputKeypress
       }