top

Remote Controller

This document covers how to handle key of remote controller.

Overview

There are 2 types of remote controller.

  • Remote controller
    This is tranditional and general input device.
  • Samsung Smart Control
    This is remote controller to be contained special and essential keys by Samsung. There are no number, color keys and etc.

Figure 1. Controllers

Figure 1. Controllers

Remote controller and Samsung Smart Control have several features. Please refer to the following.

Remote Controller

Remote controller has some different keys on normal press and long press. Please refer to the following table.

Table 1. Key of Normal Press and Long Press
Key Key Name on Normal Press Key Name on Long Press
Rewind MediaRewind MediaTrackPrevious
FastForward MediaFastForward MediaTrackNext
Note

“MediaTrackPrevious” and “MediaTrackNext” are not supported on SDK.

Samsung Smart Control

Not all of Samsung TVs support Samsung Smart Control. Please refer to the following table.

Table 2. Support Samsung Smart Control
Product Support Samsung Smart Control
Samsung UHD TV O
Samsung FHD TV X

Samsung Smart Control has different key on normal press and long press. Please refer to the following table.

Table 3. Key of Normal Press and Long Press
Key Key Name on Normal Press Key Name on Long Press
Back Back Exit
  • If you want to click keys same as Samsung Smart Control, you can use virtual key. Please click “123” key.

Figure 2. Samsung Smart Control Virtual Key

Figure 2. Samsung Smart Control Virtual Key

Implementation

Adding keydown Event

To receive event when clicking key of remote controller, please add keydown event on body.
Because it is web standard, you can get more information on keydown.

<body ... onkeydown='handleKeydown(event);'> ... </body>

or

document.body.addEventListener('keydown', handleKeyDown);

The parameter of handleKeyDown callback function is keyCode value of each key.
Please refer to Handling Key.

Note

  • After adding keydown event, application basically receives keyCode of
    "ArrowLeft", “ArrowUp”, “ArrowRight”, “ArrowDown”, “Enter” and “Back” keys.
  • To receive keyCode of other keys, you should register each keys.
    Please refer to Registering Key.

Registering Key

  • To receive keyCode of other keys as mentioned above, you should register “Key Name” by using Tizen API. Please call the method on onload.

    tizen.tvinputdevice.registerKey('MediaPlayPause');
    tizen.tvinputdevice.registerKey('ColorF0Red');
    
  • To register keys at a time for performance of launching application, you can call this method.
    (Please note that this API is supported on 2016 Samsung TV models onwards.)

    tizen.tvinputdevice.registerKeyBatch(['VolumeUp', 'VolumeDown']);
    
Note

Please note that you don’t have to register “ArrowLeft”, “ArrowUp”, “ArrowRight”, “ArrowDown”, “Enter” and “Back” keys.

  • For reference, by using the tizen.tvinputdevice.getSupportedKeys method, you can get all keys information (“Key Name”, keyCode) to be supported by product.

    var value = tizen.tvinputdevice.getSupportedKeys();
    console.log(value);
    
  • For calling these APIs, you should the following privilege. Please note that.

    <tizen:privilege name='http://tizen.org/privilege/tv.inputdevice'></tizen:privilege>
    

You can get more information on TVInputDevice API.

Handling Key

As mentioned above, the parameter of handleKeyDown callback function is keyCode value of each key. Every time clicking remote controller, this callback function is fired. Please refer to the following.

function handleKeydown (event) {
	switch (event.keyCode) {
		case tizen.tvinputdevice.getKey('MediaPlayPause').code: //10252
			// Something you want to do
		break;

		case tizen.tvinputdevice.getKey('ColorF0Red').code: //403
			// Something you want to do
		break;
	...

Key Code Table

For reference, the following table is value of keyCode listed by “Key Name”.
Please refer to the following.

Table 4. Key Code Table for Remote Controller
Key Name keyCode Key Name keyCode Key Name keyCode
ArrowLeft 37 MediaPlayPause 10252 Menu 18
ArrowUp 38 MediaRewind 412 Tools 10135
ArrowRight 39 MediaFastForward 417 Info 457
ArrowDown 40 MediaPlay 415 Source 10072
Enter 13 MediaPause 19 Exit 10182
Back 10009 MediaStop 413
MediaRecord 416 Caption 10221
VolumeUp 447 MediaTrackPrevious 10232 E-Manual 10146
VolumeDown 448 MediaTrackNext 10233 3D 10199
VolumeMute 449 Extra 10253
ChannelUp 427 0 48 PictureSize 10140
ChannelDown 428 1 49 Soccer 10228
ChannelList 10073 2 50 Teletext 10200
3 51 MTS 10195
ColorF0Red 403 4 52 Search 10225
ColorF1Green 404 5 53 Guide 458
ColorF2Yellow 405 6 54
ColorF3Blue 406 7 55
8 56
9 57
Minus 189
PreviousChannel 10190