我已经使用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);
}
}
你觉得可以怎么做?可能吗?是否有解决方法来支持播放/暂停按钮?