Mobile Web Wearable Web

Media Key: Controlling Multimedia Playback

This tutorial demonstrates how you can control multimedia playback.

The Media Key API is optional for both Tizen mobile and wearable profiles, which means that it may not be supported in all mobile and wearable devices. The Media Key API is not supported on any Tizen Emulators.

Warm-up

Become familiar with the Media Key API basics by learning about:

Managing Media Key State Changes

Learning how to register key event listener is a basic media key management skill:

  1. Implement the listener to handle media key state changes. The listener can contain event listeners for key press (onpress) and release (onrelease) notifications.
    var myMediaKeyChangeListener =
    {
       onpressed: function(key)
       {
          console.log("Pressed key: " + key);
       },
       onreleased: function(key)
       {
          console.log("Released key: " + key);
       }
    }
  2. Register the media key state change listener:
    tizen.mediakey.setMediaKeyEventListener(myMediaKeyChangeListener);
  3. Unregister the media key state change listener when it is no longer needed:
    tizen.mediakey.unsetMediaKeyEventListener();
Go to top