Search in sources :

Example 1 with AudioCapabilitiesReceiver

use of com.google.android.exoplayer.audio.AudioCapabilitiesReceiver in project LeafPic by HoraApps.

the class PlayerActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(org.horaapps.leafpic.R.layout.activity_player);
    FrameLayout root = (FrameLayout) findViewById(org.horaapps.leafpic.R.id.root);
    findViewById(R.id.video_frame).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            toggleControlsVisibility();
        }
    });
    root.setOnKeyListener(new OnKeyListener() {

        @Override
        public boolean onKey(View v, int keyCode, KeyEvent event) {
            return !(keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_ESCAPE || keyCode == KeyEvent.KEYCODE_MENU) && mediaController.dispatchKeyEvent(event);
        }
    });
    root.setBackgroundColor(ContextCompat.getColor(getApplicationContext(), R.color.md_black_1000));
    shutterView = findViewById(org.horaapps.leafpic.R.id.shutter);
    videoFrame = (AspectRatioFrameLayout) findViewById(org.horaapps.leafpic.R.id.video_frame);
    surfaceView = (SurfaceView) findViewById(org.horaapps.leafpic.R.id.surface_view);
    surfaceView.getHolder().addCallback(this);
    mediaController = new CustomMediaController(this, this);
    mediController_anchor = findViewById(org.horaapps.leafpic.R.id.media_player_anchor);
    mediaController.setAnchorView(root);
    //mediaController.setPaddingRelative(0,0,0,Measure.getNavBarHeight(PlayerActivity.this));
    toolbar = (Toolbar) findViewById(org.horaapps.leafpic.R.id.toolbar);
    initUI();
    CookieHandler currentHandler = CookieHandler.getDefault();
    if (currentHandler != defaultCookieManager)
        CookieHandler.setDefault(defaultCookieManager);
    audioCapabilitiesReceiver = new AudioCapabilitiesReceiver(this, this);
    audioCapabilitiesReceiver.register();
}
Also used : KeyEvent(android.view.KeyEvent) AudioCapabilitiesReceiver(com.google.android.exoplayer.audio.AudioCapabilitiesReceiver) FrameLayout(android.widget.FrameLayout) AspectRatioFrameLayout(com.google.android.exoplayer.AspectRatioFrameLayout) OnKeyListener(android.view.View.OnKeyListener) SurfaceView(android.view.SurfaceView) VideoControllerView(org.horaapps.leafpic.views.VideoControllerView) View(android.view.View) CookieHandler(java.net.CookieHandler)

Aggregations

KeyEvent (android.view.KeyEvent)1 SurfaceView (android.view.SurfaceView)1 View (android.view.View)1 OnKeyListener (android.view.View.OnKeyListener)1 FrameLayout (android.widget.FrameLayout)1 AspectRatioFrameLayout (com.google.android.exoplayer.AspectRatioFrameLayout)1 AudioCapabilitiesReceiver (com.google.android.exoplayer.audio.AudioCapabilitiesReceiver)1 CookieHandler (java.net.CookieHandler)1 VideoControllerView (org.horaapps.leafpic.views.VideoControllerView)1