Register a button to a forwarding action.
#include <bps/mediaplayer.h>
BPS_API int mediaplayer_register_button(int button1,
int button2,
int length,
bool immediate,
char **id)
BlackBerry 10.2.0
The first button. This must be one of the values of the media_button_t enumeration. This value cannot be MEDIA_BUTTON_NONE.
The optional second button. This must be one of the values of the media_button_t enumeration. If the value is not MEDIA_BUTTON_NONE, the function registers the action to be taken when the user presses button1 and button2 simultaneously.
The length of the button press. Use one of the values of the media_button_length_t enumeration.
This flag is effective only when registering a short button press. This flag only affects behaviour when both a short button press and a medium button press are registered for the same button or pair of buttons. If this parameter is set to false when registering a short button press, then either a short button press or a medium button press will be reported. If this parameter is set to true when registering a short button press, then only a short button press will be reported, but it will be reported immediately when the button is pressed down, and not on button up. You must also register the medium button press to get this behaviour.
When this is not a NULL value, the ID used in the button request is returned when the function completes. The caller must free this buffer using the bps_free() function. The same ID is also delivered in the corresponding MEDIAPLAYER_BUTTON_RESULT event.
The mediaplayer_register_button() function registers a button to forward a MEDIAPLAYER_BUTTON event to the application. A button event will arrive when the user releases the button, i.e., on button up.
There are various combinations of button events that you can register for:
To receive both short and medium button events for the same button or pair of buttons, you will need to call this function twice, one for each button length.
To receive the button event on button down, you must register for both short and medium button lengths. When registering the short button length, set the immediate parameter to true. You will receive a button event with a short button length as soon as the button is pressed down. Even thought you will not receive medium button length events, you must register for them to get immediate button down events.
BPS_SUCCESS when the function completes successfully, BPS_FAILURE with errno value set otherwise.