2012-09-14 66 views
1

我遇到了三星智能電視的Bightcove提供的示例應用程序(https://github.com/BrightcoveOS/Samsung-Smart-TV-Sample-App)的問題。最新(2012)型號無法使用遙控器。它似乎是一個已知的bug(https://github.com/BrightcoveOS/Samsung-Smart-TV-Sample-App/issues/3),並在github上的報告和在brightcove的支持論壇上。不幸的是,他們停止維護源代碼,沒有人回覆這個問題。三星智能電視應用程序和Brightcove示例應用程序遠程控制問題

在2010/2011模型一切工作正常。

我認爲這個問題是位於某處的enginelite.keyhandler.js:

/** 
* 
* Simple TV App Engine KeyHandler 
* 
* author: A Different Engine LLC. 
* http://adifferentengine.com 
* [email protected] 
* 
*/ 
// This is pretty straightforward. 
TVEngine.KeyHandler = { 

    keyActions: { 
     KEY_UP:    'onUp', 
     KEY_DOWN:   'onDown', 
     KEY_LEFT:   'onLeft', 
     KEY_RIGHT:   'onRight', 
     KEY_ENTER:   'onSelect', 
     KEY_RETURN:   'onReturn', 
     KEY_STOP:   'onStop', 
     KEY_FF:    'onFF', 
     KEY_RW:    'onRew', 
     KEY_PLAY:   'onPlay', 
     KEY_PAUSE:   'onPause', 
     KEY_YELLOW:   'onYellow', 
     KEY_RED:   'onRed', 
     KEY_BLUE:   'onBlue', 
     KEY_GREEN:   'onGreen', 
     KEY_EXIT:   'onExit', 
     KEY_MENU:   'onMenu', 
     KEY_BACK:   'onReturn', 
     KEY_SKIPFFORWARD: 'onSkipForward', 
     KEY_SKIPBACK:  'onSkipBack', 
    }, 
    enabled: true, 
    keyMap: {}, 

    init: function() { 
     // Maps system key list to ours 
     $KEYS = TVEngine.getPlatform().keys(); 
     // Transforming Samsung keymap into something we like slightly better. 
     for(key in $KEYS) { 
      this.keyMap[$KEYS[key]] = key; 
     } 
     this._initializeKeyHandler(); 
    }, 
    _cleared: true, 
    _initializeKeyHandler: function() { 
     var _this = this; var clear; 
     $(document).bind("keydown", function(event) { 
      var action = _this.keyActions[_this.keyMap[event.keyCode]]; 
      // $log("<<< GOT KEY ACTION: "+action+">>>"); 
      if (action && _this.enabled) _this.trigger("keyhandler:"+action); 
      return false; 
     }); 
     $(document).bind("keyup", function(event) { 
      var action = _this.keyActions[_this.keyMap[event.keyCode]]+"Release"; 
      // $log("<<< GOT KEY ACTION: "+action+" >>>"); 
      if (action) _this.trigger("keyhandler:"+action); 
      return false; 
     }) 
    }, 

    enable: function(){ 
     this.enabled = true; 
    }, 
    disable: function() { 
     this.enabled = false; 
    } 
}; 
// Now we can subscribe to the keyhandler from anywhere. 
_.extend(TVEngine.KeyHandler, Backbone.Events); 

是否有人能解決這個問題嗎?

乾杯

回答

2

你需要重寫_keys對象enginelite.platforms.js文件:

this._keys = { 
    KEY_RETURN:  88,  //36, //8 
    KEY_UP:   29460, //38, 
    KEY_DOWN:  29461, //40, 
    KEY_LEFT:  4,  //37, 
    KEY_RIGHT:  5,  //39, 
    KEY_ENTER:  29443, //13, 
    KEY_RED:  108, //65, 
    KEY_GREEN:  20,  //66, 
    KEY_YELLOW:  21,  //67, 
    KEY_BLUE:  22,  //68, 
    KEY_BACK:  8,  //I don't know what button on remote it is :) 
    KEY_PLAY:  71,  //80, 
} 

它將在所有三星的平臺上工作。

由於我的答案爲您提供了直接解決方案,@ brimil01解決方案爲您提供調試問題的方法。

+0

非常感謝 - 作品魅力! – simplyray

1

我建議檢查出的生成鍵盤映射看到初始化期間密鑰被存儲在密鑰處理程序是什麼:

for(key in $KEYS) { 
    alert(key+": "+$KEYS[key]); 
    this.keyMap[$KEYS[key]] = key; 
} 

然後捕獲鍵編碼是在keydown事件發送的內容:

$(document).bind("keydown", function(event) { 
    alert("keyCode: "+event.keyCode); 
    alert("keyMap: "+_this.keyMap[event.keyCode]); 
    var action = _this.keyActions[_this.keyMap[event.keyCode]]; 
    // $log("<<< GOT KEY ACTION: "+action+">>>"); 
    if (action && _this.enabled) _this.trigger("keyhandler:"+action); 
    return false; 
}); 

這應該給你一個關於keyhandler中發生了什麼的概念。

相關問題