Tizen Native API  5.0
Media key

The Media key API contains the media key library.

Required Header

#include <media_key.h>

Overview

The Media key API provides functions for getting the status of the media key when the key is changed.

Functions

int media_key_reserve (media_key_event_cb callback, void *user_data)
 Registers a change event callback for all media keys.
int media_key_release (void)
 Unregisters the change event callback function.

Typedefs

typedef void(* media_key_event_cb )(media_key_e key, media_key_event_e status, void *user_data)
 Called when the status of the media key is changed.

Typedef Documentation

typedef void(* media_key_event_cb)(media_key_e key, media_key_event_e status, void *user_data)

Called when the status of the media key is changed.

Since :
2.3
Parameters:
[in]keyThe key whose status is changed
[in]statusThe status of the key
[in]user_dataThe user data passed from the callback registration function
Precondition:
media_key_reserve() will invoke this callback function.
See also:
media_key_reserve()
media_key_release()

Enumeration Type Documentation

Enumeration for media keys.

Since :
2.3
Enumerator:
MEDIA_KEY_PLAY 

Play key

MEDIA_KEY_STOP 

Stop key

MEDIA_KEY_PAUSE 

Pause key

MEDIA_KEY_PREVIOUS 

Previous key

MEDIA_KEY_NEXT 

Next key

MEDIA_KEY_FASTFORWARD 

Fastforward key

MEDIA_KEY_REWIND 

Rewind key

MEDIA_KEY_PLAYPAUSE 

Playpause key

MEDIA_KEY_MEDIA 

Media key for earjack

MEDIA_KEY_UNKNOWN 

Unknown key

Enumeration for error codes of a media key.

Since :
2.3
Enumerator:
MEDIA_KEY_ERROR_NONE 

Successful

MEDIA_KEY_ERROR_INVALID_PARAMETER 

Invalid parameter

MEDIA_KEY_ERROR_OPERATION_FAILED 

Reserve/Release failed

Enumeration for event statuses of a media key.

Since :
2.3
Enumerator:
MEDIA_KEY_STATUS_PRESSED 

Pressed status

MEDIA_KEY_STATUS_RELEASED 

Released status

MEDIA_KEY_STATUS_UNKNOWN 

Unknown status


Function Documentation

int media_key_release ( void  )

Unregisters the change event callback function.

Since :
2.3
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_KEY_ERROR_NONESuccessful
MEDIA_KEY_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_KEY_ERROR_OPERATION_FAILEDRelease key failed
See also:
media_key_reserve()
int media_key_reserve ( media_key_event_cb  callback,
void *  user_data 
)

Registers a change event callback for all media keys.

Since :
2.3
Parameters:
[in]callbackThe callback function to invoke
[in]user_dataThe user data to be passed to the callback function
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_KEY_ERROR_NONESuccessful
MEDIA_KEY_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_KEY_ERROR_OPERATION_FAILEDReserve key failed
See also:
media_key_release()