Media keys are the keys of a Bluetooth headset which control multimedia playback.
For more information on the MediaKey features, see MediaKey Guide.
Since: 2.3
Interface | Method |
---|---|
MediaKeyManagerObject | |
MediaKeyManager | void setMediaKeyEventListener (MediaKeyEventCallback callback) void unsetMediaKeyEventListener () |
MediaKeyEventCallback | void onpressed (MediaKeyType type) void onreleased (MediaKeyType type) |
enum MediaKeyType { "MEDIA_PLAY", "MEDIA_STOP", "MEDIA_PAUSE", "MEDIA_PREVIOUS", "MEDIA_NEXT", "MEDIA_FAST_FORWARD", "MEDIA_REWIND", "MEDIA_PLAY_PAUSE" };
Since: 2.3
[NoInterfaceObject] interface MediaKeyManagerObject { readonly attribute MediaKeyManager mediakey; };
Tizen implements MediaKeyManagerObject;
Since: 2.3
There is a tizen.mediakey object that allows accessing the functionality of the MediaKey API.
[NoInterfaceObject] interface MediaKeyManager { void setMediaKeyEventListener(MediaKeyEventCallback callback) raises(WebAPIException); void unsetMediaKeyEventListener() raises(WebAPIException); };
Since: 2.3
setMediaKeyEventListener
void setMediaKeyEventListener(MediaKeyEventCallback callback);
Since: 2.3
Parameters:
Exceptions:
with error type TypeMismatchError, if the input parameter is not compatible with the expected type.
with error type UnknownError in any other error case.
Code example:
tizen.mediakey.setMediaKeyEventListener({ onpressed: function(key) { console.log("Pressed key: " + key); }, onreleased: function(key) { console.log("Released key: " + key); } });
unsetMediaKeyEventListener
void unsetMediaKeyEventListener();
Since: 2.3
Exceptions:
with error type UnknownError in any other error case.
Code example:
tizen.mediakey.unsetMediaKeyEventListener();
[Callback, NoInterfaceObject] interface MediaKeyEventCallback { void onpressed(MediaKeyType type); void onreleased(MediaKeyType type); };
Since: 2.3
onpressed
void onpressed(MediaKeyType type);
Since: 2.3
Parameters:
onreleased
void onreleased(MediaKeyType type);
Since: 2.3
Parameters:
To guarantee that the MediaKey application runs on a device with Bluetooth feature, declare the following feature requirements in the config file:
module MediaKey { enum MediaKeyType { "MEDIA_PLAY", "MEDIA_STOP", "MEDIA_PAUSE", "MEDIA_PREVIOUS", "MEDIA_NEXT", "MEDIA_FAST_FORWARD", "MEDIA_REWIND", "MEDIA_PLAY_PAUSE" }; [NoInterfaceObject] interface MediaKeyManagerObject { readonly attribute MediaKeyManager mediakey; }; Tizen implements MediaKeyManagerObject; [NoInterfaceObject] interface MediaKeyManager { void setMediaKeyEventListener(MediaKeyEventCallback callback) raises(WebAPIException); void unsetMediaKeyEventListener() raises(WebAPIException); }; [Callback, NoInterfaceObject] interface MediaKeyEventCallback { void onpressed(MediaKeyType type); void onreleased(MediaKeyType type); }; };