mirror of
https://github.com/samsonjs/media.git
synced 2026-04-08 11:45:51 +00:00
Handle play/pause button in the Demo app on Android TV.
This commit is contained in:
parent
c3bf60b1a9
commit
31552b8cdf
2 changed files with 12 additions and 1 deletions
|
|
@ -47,12 +47,14 @@ import android.os.Bundle;
|
|||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.Display;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.SurfaceHolder;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.View.OnKeyListener;
|
||||
import android.view.View.OnTouchListener;
|
||||
import android.view.WindowManager;
|
||||
import android.view.accessibility.CaptioningManager;
|
||||
|
|
@ -131,7 +133,15 @@ public class PlayerActivity extends Activity implements SurfaceHolder.Callback,
|
|||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
root.setOnKeyListener(new OnKeyListener() {
|
||||
@Override
|
||||
public boolean onKey(View v, int keyCode, KeyEvent event) {
|
||||
if (keyCode == KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE) {
|
||||
return mediaController.dispatchKeyEvent(event);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
audioCapabilitiesReceiver = new AudioCapabilitiesReceiver(getApplicationContext(), this);
|
||||
|
||||
shutterView = findViewById(R.id.shutter);
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/root"
|
||||
android:focusable="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:keepScreenOn="true">
|
||||
|
|
|
|||
Loading…
Reference in a new issue