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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Developer
Posts: 29
Registered: ‎05-22-2012
My Device: any BB10 released
My Carrier: Airtel
Accepted Solution

How to play 2 or more sounds at the same time?

i'm building an instrument app using QML & everything turns up fine except this little thing. I've created several 'ImageButton' & gave individual sounds to them by 'onClicked' command. but i found these sounds play in a queue (second click plays after first button audio gets completed & third plays after 2nd & so on...) instead of playing at the same time. Is there any command that enables buttons to initiate at the same time?

 

thanks

Highlighted
Developer
Posts: 43
Registered: ‎08-02-2012
My Device: Z10
My Carrier: RIM

Re: How to play 2 or more sounds at the same time?

if you use MediaPlayer, you can create one MediaPlayer for 1 sound.

Ex:

MediaPlayer {

 id: media1

sourceUrl: "asset:///sounds/1.mp3"

}

MediaPlayer {

id: media2

sourceUrl: "asset:///sounds/2.mp3"

}

 

Then you can call them

Developer
Posts: 29
Registered: ‎05-22-2012
My Device: any BB10 released
My Carrier: Airtel

Re: How to play 2 or more sounds at the same time?

i am using MediaPlayer. Here is the code:

ImageButton {
                                              id: tabla2d
                                              //imageSource: "asset:///images/tabla2.png"
                                              
                                              layoutProperties: AbsoluteLayoutProperties {
                                          positionX: 341
                                          positionY: 610
                                                  
                                              }
                                              onClicked: {
                                                          
                                                          myPlayer.setSourceUrl("asset:///sounds/maidan2.wav")
                                                          myPlayer.play()
                                                      }
                                              
                                              defaultImageSource: ""
                                              pressedImageSource: "asset:///images/maidan2.png"
                                              disabledImageSource: ""
                               overlapTouchPolicy: OverlapTouchPolicy.Allow
           

                                          }

 ...

attachedObjects: [       
                        SystemSound {
                            id: systemSound
                            sound: soundSelectorDropdown.selectedValue
                       },
                        MediaPlayer {
                            id: myPlayer
                    }        
                    ]       

 

any changes?

Developer
Posts: 43
Registered: ‎08-02-2012
My Device: Z10
My Carrier: RIM

Re: How to play 2 or more sounds at the same time?

[ Edited ]

You can add more myPlayer

 

 ....

 MediaPlayer {

id: myPlayer2

}

 

Now you can player your sound with myPlayer2 at the same time with myPlayer.

You can create as many myPlayer you want then play them at the same time with different sound.

Hope this help

Developer
Posts: 29
Registered: ‎05-22-2012
My Device: any BB10 released
My Carrier: Airtel

Re: How to play 2 or more sounds at the same time?

thanks man. works the way i needed. appreciate it