android / media-samples

Multiple samples showing the best practices in media APIs on Android (audio, video, etc.).
Apache License 2.0
1.27k stars 740 forks source link

PictureInPicture sample app keeps crashing. #80

Open awesome1128 opened 3 years ago

awesome1128 commented 3 years ago

Hi Yaraki. Nice to meet you. You're doing a great jobs. I saw your repositories, so it's amazing. I have one issue now. When I try to run your PIP sample app on android emulator, app keeps crashing. Could you please guide me? I am waiting for your positive response. Thank you.

Y-E-P commented 3 years ago

Hi @awesome1128 Just write check for nullable, because getWindowInsetsController method used for platform 30(or, as I correctly understand, for other versions which supported insets) for make immersive full screen.

private void adjustFullScreen(Configuration config) {
        final WindowInsetsControllerCompat insetsController =
                ViewCompat.getWindowInsetsController(getWindow().getDecorView());
        if(insetsController == null) return;
      ...
    }

Update: You can use WindowCompat.getInsetsController(getWindow(), getWindow().getDecorView()); and it already prepared to handle insets on all Android API.

sanbrother commented 3 years ago

Hi @awesome1128 Just write check for nullable, because getWindowInsetsController method used for platform 30(or, as I correctly understand, for other versions which supported insets) for make immersive full screen.

private void adjustFullScreen(Configuration config) {
        final WindowInsetsControllerCompat insetsController =
                ViewCompat.getWindowInsetsController(getWindow().getDecorView());
        if(insetsController == null) return;
      ...
    }

Update: You can use WindowCompat.getInsetsController(getWindow(), getWindow().getDecorView()); and it already prepared to handle insets on all Android API.

Great! A PR would be better. :100:

73alex commented 2 years ago

Ok