This commit is contained in:
Bnyro 2022-06-26 17:49:42 +02:00
parent 8a053e87e1
commit bae1182f21
2 changed files with 9 additions and 23 deletions

View File

@ -2,6 +2,7 @@ package com.github.libretube.fragments
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.app.NotificationManager import android.app.NotificationManager
import android.app.PictureInPictureParams
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import android.content.pm.ActivityInfo import android.content.pm.ActivityInfo
@ -439,7 +440,9 @@ class PlayerFragment : Fragment() {
createExoPlayer(view) createExoPlayer(view)
prepareExoPlayerView() prepareExoPlayerView()
if (response.chapters != null) initializeChapters(response.chapters) if (response.chapters != null) initializeChapters(response.chapters)
// set media sources for the player
setResolutionAndSubtitles(view, response) setResolutionAndSubtitles(view, response)
initializePlayerView(view, response)
// support for time stamped links // support for time stamped links
if (arguments?.getLong("timeStamp") != null) { if (arguments?.getLong("timeStamp") != null) {
val position = arguments?.getLong("timeStamp")!! * 1000 val position = arguments?.getLong("timeStamp")!! * 1000
@ -447,9 +450,9 @@ class PlayerFragment : Fragment() {
} }
exoPlayer.prepare() exoPlayer.prepare()
exoPlayer.play() exoPlayer.play()
initializePlayerView(view, response)
initializePlayerNotification(requireContext()) initializePlayerNotification(requireContext())
fetchSponsorBlockSegments() fetchSponsorBlockSegments()
// show comments if related streams disabled
if (!relatedStreamsEnabled) toggleComments() if (!relatedStreamsEnabled) toggleComments()
} }
} }
@ -1129,7 +1132,11 @@ class PlayerFragment : Fragment() {
isFullScreen isFullScreen
) )
) { ) {
requireActivity().enterPictureInPictureMode() activity?.enterPictureInPictureMode(updatePipParams())
} }
} }
private fun updatePipParams() = PictureInPictureParams.Builder()
.setActions(emptyList())
.build()
} }

View File

@ -166,27 +166,6 @@
</LinearLayout> </LinearLayout>
<HorizontalScrollView
android:id="@id/exo_extra_controls_scroll_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|end"
android:visibility="invisible">
<LinearLayout
android:id="@id/exo_extra_controls"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layoutDirection="ltr">
<ImageButton
android:id="@id/exo_overflow_hide"
style="@style/ExoStyledControls.Button.Bottom.OverflowHide" />
</LinearLayout>
</HorizontalScrollView>
<LinearLayout <LinearLayout
android:id="@+id/progress_bar" android:id="@+id/progress_bar"
android:layout_gravity="bottom" android:layout_gravity="bottom"