1

我已经使用ARC Welder在 Chrome 中成功运行了我的应用程序。我想在我的应用程序内的 MacBook 上使用播放/暂停按钮。

我的应用程序在 Android 中正常响应媒体按钮,如下所示。它适用于谷歌电视安卓电视。但不适用于 Chrome ARC。

我还响应空间和输入按钮,它们在 Chrome ARC 上完美运行。

这是我在我的代码中使用的代码Activity

@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
    switch (keyCode) {
        case KeyEvent.KEYCODE_MEDIA_PLAY:
        case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE:
        case KeyEvent.KEYCODE_MEDIA_PAUSE:
        case KeyEvent.KEYCODE_SPACE:
        case KeyEvent.KEYCODE_ENTER:
        case KeyEvent.KEYCODE_NUMPAD_ENTER:
        case KeyEvent.KEYCODE_DPAD_CENTER:
            playPause();
            return true;
        case KeyEvent.KEYCODE_MEDIA_STOP:
            sendOrderedBroadcast(BaseNotificationService.STOP_INTENT, null);
            return true;
        default:
            return super.onKeyUp(keyCode, event);
    }
}

你觉得可以怎么做?可能吗?是否有解决方法来支持播放/暂停按钮?

4

1 回答 1

5

ARC currently lacks a complete mapping to translate all keycodes we get through the Chrome PPAPI into their Android equivalent versions.

There isn't really a work around -- the keyboard event just won't go through since there is no translation for it.

Since I tracked down some specifics while looking into it, I went ahead and filed this bug to track it. Feel free to star it.

于 2015-04-16T19:21:16.913 回答