Merge pull request #3343 from Bnyro/master

Fix crashes on audio player transitions
This commit is contained in:
Bnyro 2023-03-22 11:20:35 +01:00 committed by GitHub
commit 7d0c48cc75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 7 deletions

View File

@ -17,7 +17,6 @@ import androidx.constraintlayout.motion.widget.MotionLayout
import androidx.fragment.app.Fragment
import androidx.fragment.app.activityViewModels
import androidx.fragment.app.commit
import androidx.navigation.fragment.findNavController
import com.github.libretube.R
import com.github.libretube.api.obj.StreamItem
import com.github.libretube.databinding.FragmentAudioPlayerBinding
@ -123,6 +122,8 @@ class AudioPlayerFragment : Fragment(), AudioPlayerOptions {
}
binding.openVideo.setOnClickListener {
BackgroundHelper.stopBackgroundPlay(requireContext())
killFragment()
NavigationHelper.navigateVideo(
context = requireContext(),
videoId = PlayingQueue.getCurrent()?.url?.toID(),
@ -130,8 +131,6 @@ class AudioPlayerFragment : Fragment(), AudioPlayerOptions {
keepQueue = true,
forceVideo = true
)
BackgroundHelper.stopBackgroundPlay(requireContext())
findNavController().popBackStack()
}
binding.share.setOnClickListener {

View File

@ -478,10 +478,8 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions {
keepQueue = true,
keepVideoPlayerAlive = true
)
handler.postDelayed(500) {
NavigationHelper.startAudioPlayer(requireContext())
killPlayerFragment()
}
killPlayerFragment()
NavigationHelper.startAudioPlayer(requireContext())
}
private fun setFullscreen() {