Skip to content

The Hidden Developer

A place to share my learning to the world

Handle remote key events in Smart TV

Handling remote key events in Tizen TV

Posted on December 30, 2022December 30, 2022 By Karthic C D No Comments on Handling remote key events in Tizen TV
In the previous article, we went through what makes a Tizen TV application. In this article we will look into how to handle the remote key events in Tizen TV using code. Handling remote key events has been one of the basic requirements when developing applications for Tizen TV. Tizen TV SDK provides support for the developers to control the remote key press events and do actions in the applications accordingly. This article provides an introduction to how to handle the key events in Tizen TV using the API provided in the SDK. We will go through the basic steps the developer needs to ensure that his application handles the remote key events smoothly without any hurdles. We will see how this can be done in this article.

Role of remote in Smart TV

Remote is one of the primary modes of interaction with the TV. There are various modes of user interaction in a Smart TV apart from the remote like gesture control, Bluetooth device connections, direct hardware devices like keyboards and mice, etc. Remote is the basic one where every user is comfortable interacting with the TV right from the start when we started using TVs. User interaction with the TV is one aspect that makes Smart TV usage more engaging. The Remote in a Smart TV is used for various elements like opening/closing applications, changing settings, voice-based interactions in the case of smart remote, etc. So handling the remote key event has become one of the basic necessities that need to be included when developing Tizen TV applications.

Handling remote key events

In a Tizen TV environment, all the features that are available for the developers as APIs are available as modules. The developer has to include the module in the config file and then have to use the provided APIs for development. In Tizen development terminology, we name this module Privileges. The privilege that we are going to use here is the tvinputdevice privilege. We import it in the config file as follows.
<tizen:privilege name='http://tizen.org/privilege/tv.inputdevice'>
</tizen:privilege> 
Once the privilege is imported, we are ready to start with the coding. The basic flow of the coding to handle the key events, in general, goes as follows.
 
  • The developer already knows the keys to handle his application. So he has to register those keys to the Tizen TV engine (Application manager)
  • The specified elements that handle the key press use the W3C attribute onkeydown to handle that specific event
  • The resulting logic is done inside the event handler function. The overall event handler mechanism works in the same way as we handle key events in a normal web application.
Let’s look at the basic code flow in detail using simple code snippets
Register the Keys
tizen.tvinputdevice.registerKey('MediaPlayPause')
Register the key event handler
<button onkeydown="handleKeyDown(event);">...</button>
Write logic inside the handler function
function handleKeyDown(evnet) {
    console.log(`The key pressed is ${event.keyCode})`)
}

Things to consider

The following are the things that the developer should keep in mind when developing a smart TV application
  • The application should easily integrate with the basic remote keys such as Enter, Back, Arrow keys etc for smooth navigation
  • The application should provide easy navigation to all it’s contents using the basic navigation keys in the remote. This will be intuitive to the user and will provide a seamless experience.
  • The developer should properly register the keys that are needed for the application navigation and functionality so that, the user does not face any trouble

Conclusion

In this post, we saw about how to handle the remote key events in Tizen TV applications so that it provides a seamless experience to the user. The developer can make use of the APIs provided in the tvInputDevice module and can handle the key events in the remote. In the next article we will explore more into further areas of user interaction with the Tizen TV.
samsung smart tv, Samsung smart tv development, Tizen TV development Tags:samsung smart tv apps, samsung tv widgets, smart tv developement, tizen tv apps, tizen tv development, tizen tv widgets, tizen widgets

Post navigation

Previous Post: Packaged Web Applications – Tizen TV
Next Post: Additional options in handling Tizen TV remote key events

Related Posts

  • Packaged Web Applications – Tizen TV samsung smart tv
  • Handle remote key events in Smart TV
    Additional options in handling Tizen TV remote key events samsung smart tv

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Copyright © 2023 The Hidden Developer.

Powered by PressBook News WordPress theme