0

trace remote keys

Hello,

is it possible to trace the remote key code? i know we can do this, i use help from this.
http://developer.yahoo.net/forum/?showtopi...okiecheckonly=1
but my main query is, is it possible to modify the functionality of remote play, pause, fast froward, and rewind button for screens having no media player.
means if i face a screen having images and text on that and from that screen if i press the remote play button, it will starts to play previous video in media player. i don't want to active media player until i press play button. i want to disable to play video in media player directly without pressing the button.
so for that i think i have to modify the functionality for those buttons only for non media player screen. so is it possible to do this? i read somewhere in pdf that we can't change the basic controls functionality.
so i am confused. please help.
Thanks.

by
9 Replies
  • QUOTE (DEEPKUMAR @ Mar 16 2011, 02:17 PM) <{POST_SNAPBACK}>
    Hello,

    is it possible to trace the remote key code? i know we can do this, i use help from this.
    http://developer.yahoo.net/forum/?showtopi...okiecheckonly=1
    but my main query is, is it possible to modify the functionality of remote play, pause, fast froward, and rewind button for screens having no media player.
    means if i face a screen having images and text on that and from that screen if i press the remote play button, it will starts to play previous video in media player. i don't want to active media player until i press play button. i want to disable to play video in media player directly without pressing the button.
    so for that i think i have to modify the functionality for those buttons only for non media player screen. so is it possible to do this? i read somewhere in pdf that we can't change the basic controls functionality.
    so i am confused. please help.
    Thanks.

    Which tv are you using? And what are the versions of the engine, framework and container?
    0
  • QUOTE (Benjamin Toll @ Mar 16 2011, 03:04 PM) <{POST_SNAPBACK}>
    Which tv are you using? And what are the versions of the engine, framework and container?

    Thanks for replay.
    it is Vizio TV.
    Framework:: 1.3.12
    Engine::5.4.2
    Container::1.3.9
    0
  • QUOTE (DEEPKUMAR @ Mar 16 2011, 03:13 PM) <{POST_SNAPBACK}>
    Thanks for replay.
    it is Vizio TV.
    Framework:: 1.3.12
    Engine::5.4.2
    Container::1.3.9

    Are you back in a sidebar view when you press play on the tv remote? And then the video plays? If that's not the use case, please be very specific when detailing.
    0
  • QUOTE (Benjamin Toll @ Mar 16 2011, 04:56 PM) <{POST_SNAPBACK}>
    Are you back in a sidebar view when you press play on the tv remote? And then the video plays? If that's not the use case, please be very specific when detailing.

    no i have 3 screens having images and texts. when i press play button from sc1 that is full screen not a sidebar screen then i will face the media player. and the play button to play video will be on screen3. at any moment and from screen1, screen2 when i press the play button from remote it will start to play the video that is last time i played. i don't want to play video with remote play button. it will only play after pressing play button from screen3. i think you got my point.
    in short i want to disable the remote play button. can i do this?
    Thanks.
    0
  • QUOTE (DEEPKUMAR @ Mar 16 2011, 05:30 PM) <{POST_SNAPBACK}>
    no i have 3 screens having images and texts. when i press play button from sc1 that is full screen not a sidebar screen then i will face the media player. and the play button to play video will be on screen3. at any moment and from screen1, screen2 when i press the play button from remote it will start to play the video that is last time i played. i don't want to play video with remote play button. it will only play after pressing play button from screen3. i think you got my point.
    in short i want to disable the remote play button. can i do this?
    Thanks.

    So every time you press play on the remote and the mediaplayer plays the last video (the behavior that you do not want) you're in a fullscreen view?

    I'm trying to establish this b/c that would be a bug. It'd be better to address that than to hack around it by attempting to disable remote control buttons.
    0
  • QUOTE (Benjamin Toll @ Mar 16 2011, 06:00 PM) <{POST_SNAPBACK}>
    So every time you press play on the remote and the mediaplayer plays the last video (the behavior that you do not want) you're in a fullscreen view?

    I'm trying to establish this b/c that would be a bug. It'd be better to address that than to hack around it by attempting to disable remote control buttons.

    yes i am in full screen view. and i don't want to play video with remote play button.
    please more clear on your last post.
    Thanks.
    0
  • QUOTE (DEEPKUMAR @ Mar 17 2011, 07:55 AM) <{POST_SNAPBACK}>
    yes i am in full screen view. and i don't want to play video with remote play button.
    please more clear on your last post.
    Thanks.

    I'm looking into this and will get back to you when I have something. Thanks.
    0
  • QUOTE (DEEPKUMAR @ Mar 16 2011, 05:30 PM) <{POST_SNAPBACK}>
    no i have 3 screens having images and texts. when i press play button from sc1 that is full screen not a sidebar screen then i will face the media player. and the play button to play video will be on screen3. at any moment and from screen1, screen2 when i press the play button from remote it will start to play the video that is last time i played. i don't want to play video with remote play button. it will only play after pressing play button from screen3. i think you got my point.
    in short i want to disable the remote play button. can i do this?
    Thanks.

    There are two ways you can disable the remote control buttons. The first is global, the second is specific to the fullscreen view where you don't want the video to play (i.e., any fullscreen other than the one that will play your video). Each one is the same: you subscribe to a mediaplayer event, listen for specific key codes and then prevent the default behavior from occurring (playing the video).

    The first method is to subscribe the entire widget to the mediaplayer. You'd put this code in init.js:

    CODE
    (function (event) {
    if (KONtx.application.getCurrentViewId() !== "view-mediaplayer") {
    switch (event.type) {
    case "onRemoteKeyPress":
    if ($contains(event.payload.keyCode, [19, 413, 412, 415, 417])) {
    event.preventDefault();
    }
    break;
    }
    }
    }.subscribeTo(KONtx.mediaplayer, "onRemoteKeyPress"));


    Hopefully, this code is self-explanatory. You subscribe to the mediaplayer's onRemoteKeyPress event. In the listener, you must first check the current view id to make sure that you're not currently in the mediaplayer view (for obvious reasons you don't want to block key codes in your mediaplayer view). Then, it checks the event type and the key code. If the key code is one of those sent when the remote control play, pause, stop, etc. is pressed, then prevent the default mediaplayer behavior, which is to either play, pause, stop, etc. the video.

    By the way, I took the key codes from the mediaplayer source code. Also, look at line 372 in that file, you'll see where the onRemoteKeyPress event is fired by the mediaplayer and how calling preventDefault() in your listener (that is, returning false) doesn't run the code in the conditional that is the mediaplayer's usual path of playing a video (or stopping, pausing, etc.).

    Ok, so here's the bad news; due to a known bug, this solution may not work because the current view id is being set incorrectly in the application class. This bug has been fixed, but most devices don't have the framework fix yet.

    So, the second way to fix this is to subscribe to the mediaplayer in every fullscreen view where video shouldn't be played. This may actually not be too bad, as most developers only have one fullscreen view in their widget anyway. You'd subscribe to it in the updateView and unsubscribe from it in the hideView. It's VERY important that you remember to unsubscribe from it or the remote control keys will be disabled even on your mediaplayer view since the mediaplayer is a singleton and thus isn't bound to any view.

    Tested on 2010 Samsung.

    By the way, thanks for finding this bug.
    0
  • QUOTE (Benjamin Toll @ Mar 18 2011, 05:20 PM) <{POST_SNAPBACK}>
    There are two ways you can disable the remote control buttons. The first is global, the second is specific to the fullscreen view where you don't want the video to play (i.e., any fullscreen other than the one that will play your video). Each one is the same: you subscribe to a mediaplayer event, listen for specific key codes and then prevent the default behavior from occurring (playing the video).

    The first method is to subscribe the entire widget to the mediaplayer. You'd put this code in init.js:

    CODE
    (function (event) {
    if (KONtx.application.getCurrentViewId() !== "view-mediaplayer") {
    switch (event.type) {
    case "onRemoteKeyPress":
    if ($contains(event.payload.keyCode, [19, 413, 412, 415, 417])) {
    event.preventDefault();
    }
    break;
    }
    }
    }.subscribeTo(KONtx.mediaplayer, "onRemoteKeyPress"));


    Hopefully, this code is self-explanatory. You subscribe to the mediaplayer's onRemoteKeyPress event. In the listener, you must first check the current view id to make sure that you're not currently in the mediaplayer view (for obvious reasons you don't want to block key codes in your mediaplayer view). Then, it checks the event type and the key code. If the key code is one of those sent when the remote control play, pause, stop, etc. is pressed, then prevent the default mediaplayer behavior, which is to either play, pause, stop, etc. the video.

    By the way, I took the key codes from the mediaplayer source code. Also, look at line 372 in that file, you'll see where the onRemoteKeyPress event is fired by the mediaplayer and how calling preventDefault() in your listener (that is, returning false) doesn't run the code in the conditional that is the mediaplayer's usual path of playing a video (or stopping, pausing, etc.).

    Ok, so here's the bad news; due to a known bug, this solution may not work because the current view id is being set incorrectly in the application class. This bug has been fixed, but most devices don't have the framework fix yet.

    So, the second way to fix this is to subscribe to the mediaplayer in every fullscreen view where video shouldn't be played. This may actually not be too bad, as most developers only have one fullscreen view in their widget anyway. You'd subscribe to it in the updateView and unsubscribe from it in the hideView. It's VERY important that you remember to unsubscribe from it or the remote control keys will be disabled even on your mediaplayer view since the mediaplayer is a singleton and thus isn't bound to any view.

    Tested on 2010 Samsung.

    By the way, thanks for finding this bug.

    Thanks, this one is really nice comment. Thanks.
    0

Recent Posts

in Design / Interaction - Yahoo! TV Widgets