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.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()
}

View File

@ -166,27 +166,6 @@
</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
android:id="@+id/progress_bar"
android:layout_gravity="bottom"