I am in the process of developing an App for Samsung Smart TVs with their newest SDK.
I have a scene-based Application and now want to control it using the TV remove.
The naive approach, using jQuerys .select()
to make the cursor go into one of the input fields seems to disable the remote completely, the error is
body is not activated currently... skip! : INPUT
As far as I could find out this has something to do with the body-element having an onkeydown-Handler.
This leads to me basically needing to manage the focussed / blur status by hand, not being able to use CSS-selectors such as :active, :focussed, which would be not really neat.
Any help / links to documentation / etc would be appreciated.
I am developing the application under Mac OS utilizing the VMWare-Based emulator.
What we have been doing with our apps is assigning a class to the active element in the scene. Then using javascript you can add listeners based on which of your page elements are active.
So for instance when the application loads you can assign an active class to the first button on a page in your HTML. Then you can have listeners for buttons on the remote so that the down button would change the active state to the next button in the scene.
//key press listener for remote
SceneScene1.prototype.handleKeyDown = function (keyCode) {
//find the key code you are looking for
switch (keyCode) {
case sf.key.LEFT:
//code for left keypress
break;
case sf.key.RIGHT:
//code for left keypress
break;
case sf.key.UP:
//code for up keypress
break;
case sf.key.DOWN:
//code for down keypress
if ($('#button1').hasClass('active')) {
$('#button1').removeClass('active');
$('#button2').addClass('active');
}
break;
case sf.key.ENTER:
//code for enter keypress
break;
}
}
You are right, it does not seem all that clean but its about as good as it gets when you are interfacing with a remote. You have to specify the "focused" elements and use them as the context for instructions from the remote.