Show better information about player errors

This commit is contained in:
Stypox 2025-07-28 23:57:55 +02:00
parent 38064be702
commit 29a3ca83b5
No known key found for this signature in database
GPG key ID: 4BDF1B40A49FDD23
3 changed files with 18 additions and 9 deletions

View file

@ -17,6 +17,7 @@ import io.reactivex.rxjava3.schedulers.Schedulers
import org.schabi.newpipe.MainActivity
import org.schabi.newpipe.NewPipeDatabase
import org.schabi.newpipe.R
import org.schabi.newpipe.error.ErrorInfo
import org.schabi.newpipe.extractor.InfoItem.InfoType
import org.schabi.newpipe.extractor.exceptions.ContentNotAvailableException
import org.schabi.newpipe.extractor.linkhandler.ListLinkHandler
@ -84,7 +85,7 @@ class MediaBrowserPlaybackPreparer(
},
{ throwable ->
Log.e(TAG, "Failed to start playback of media ID [$mediaId]", throwable)
onPrepareError()
onPrepareError(throwable)
}
)
}
@ -115,9 +116,9 @@ class MediaBrowserPlaybackPreparer(
)
}
private fun onPrepareError() {
private fun onPrepareError(throwable: Throwable) {
setMediaSessionError.accept(
ContextCompat.getString(context, R.string.error_snackbar_message),
ContextCompat.getString(context, ErrorInfo.getMessageStringId(throwable, null)),
PlaybackStateCompat.ERROR_CODE_APP_ERROR
)
}