Fix a crash when the queue is empty

This commit is contained in:
Bnyro 2022-10-23 15:22:36 +02:00
parent fb21dd2543
commit b5c6a27264
2 changed files with 11 additions and 6 deletions

View File

@ -757,15 +757,19 @@ class PlayerFragment : BaseFragment() {
// used for autoplay and skipping to next video
private fun playNextVideo() {
val nextVideo = PlayingQueue.getNext()
val nextVideoId = PlayingQueue.getNext()
// by making sure that the next and the current video aren't the same
saveWatchPosition()
// forces the comments to reload for the new video
commentsLoaded = false
binding.commentsRecView.adapter = null
// save the id of the next stream as videoId and load the next video
videoId = nextVideo
playVideo()
if (nextVideoId != null) {
videoId = nextVideoId
// forces the comments to reload for the new video
commentsLoaded = false
binding.commentsRecView.adapter = null
playVideo()
}
}
private fun prepareExoPlayerView() {

View File

@ -349,6 +349,7 @@
<string name="time_code">Time code</string>
<string name="added_to_playlist">Added to playlist</string>
<string name="playing_queue">Playing queue</string>
<string name="queue">Queue</string>
<!-- Notification channel strings -->
<string name="download_channel_name">Download Service</string>