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
New Contributor
encore123
Posts: 2
Registered: ‎02-18-2013
My Device: bb 10

Media key watcher

 Hi,

 

can someone help me how to use MediakeyWatcher, i its same like in java MediaAction method, but i am new to C++.

 

i want to perform some action when someone press PlayPuse Media button on device

 

here what i found on BB Docs

QObject::connect(&keyWatcher, SIGNAL(longPress(bb::multimedia::MediaKey::Type)), this, SLOT(onLongPress());
QObject::connect(&keyWatcher, SIGNAL(shortPress(bb::multimedia::MediaKey::Type)), this, SLOT(onShortPress());
 
but i dont know how to use it, please help me with example
 
 
 
Thanks
Retired
s_rashid
Posts: 127
Registered: ‎02-27-2012
My Device: Bold

Re: Media key watcher

Hi @encore123,

Before we go further with the specifics for MediaKeyWatcher, would it be possible to share your use case? Are you trying to listen for the Play/Pause buttons for anything related to audio/video playback? Or are you just trying to override the action of those buttons for your app context?

 

If it is the first case (i.e. something related to multimedia playback), you should be using the NowPlayingConnection service instead, which makes things much easier; not to mention that you get a lot of useful features with it and it is definitely a *must* for any apps where they have multimedia content for consumption.

Let us know what you think.

 

Thanks,
Rashid

Application Development Consultant | Developer Relations

BlackBerry
@surashid

Developer
fracobx19
Posts: 35
Registered: ‎11-17-2013
My Device: Blackberry Simulator 10.2

Re: Media key watcher

[ Edited ]

Hi, I'm looking for the same answere but i Think it would be better just to reply here instead of creating a new message.

 

What I want to do is to take a photo in a camera app when the play/stop button (the one between the volume up and volume down in a BBQ10) is pressed, and if the camera is in video mode, to start recording and stop recording with this same button. Also It would be great to know how to add extra functions to the volume up and volume down like.

 

Thanks In Advance :smileyvery-happy:

 

P.D. If there is a way to do so from QML that wolud save me some time (Y)