From bae1182f21840655e7e21ae73ab0bda14387806e Mon Sep 17 00:00:00 2001 From: Bnyro Date: Sun, 26 Jun 2022 17:49:42 +0200 Subject: [PATCH] fix --- .../libretube/fragments/PlayerFragment.kt | 11 ++++++++-- .../layout/exo_styled_player_control_view.xml | 21 ------------------- 2 files changed, 9 insertions(+), 23 deletions(-) diff --git a/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt b/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt index 667d40c3e..24dff80ca 100644 --- a/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt +++ b/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt @@ -2,6 +2,7 @@ package com.github.libretube.fragments import android.annotation.SuppressLint import android.app.NotificationManager +import android.app.PictureInPictureParams import android.content.Context import android.content.Intent import android.content.pm.ActivityInfo @@ -439,7 +440,9 @@ class PlayerFragment : Fragment() { createExoPlayer(view) prepareExoPlayerView() if (response.chapters != null) initializeChapters(response.chapters) + // set media sources for the player setResolutionAndSubtitles(view, response) + initializePlayerView(view, response) // support for time stamped links if (arguments?.getLong("timeStamp") != null) { val position = arguments?.getLong("timeStamp")!! * 1000 @@ -447,9 +450,9 @@ class PlayerFragment : Fragment() { } exoPlayer.prepare() exoPlayer.play() - initializePlayerView(view, response) initializePlayerNotification(requireContext()) fetchSponsorBlockSegments() + // show comments if related streams disabled if (!relatedStreamsEnabled) toggleComments() } } @@ -1129,7 +1132,11 @@ class PlayerFragment : Fragment() { isFullScreen ) ) { - requireActivity().enterPictureInPictureMode() + activity?.enterPictureInPictureMode(updatePipParams()) } } + + private fun updatePipParams() = PictureInPictureParams.Builder() + .setActions(emptyList()) + .build() } diff --git a/app/src/main/res/layout/exo_styled_player_control_view.xml b/app/src/main/res/layout/exo_styled_player_control_view.xml index 291b9d370..6c1566c57 100644 --- a/app/src/main/res/layout/exo_styled_player_control_view.xml +++ b/app/src/main/res/layout/exo_styled_player_control_view.xml @@ -166,27 +166,6 @@ - - - - - - - - - -