Merge pull request #7166 from litetex/various-fixes-for-mediasession-player

Various fixes related to MediasessionManager
This commit is contained in:
Robin 2021-09-27 23:45:38 +02:00 committed by GitHub
commit f48ff610a3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 215 additions and 102 deletions

View file

@ -17,6 +17,7 @@ import org.schabi.newpipe.extractor.stream.StreamType.LIVE_STREAM
import org.schabi.newpipe.extractor.stream.StreamType.VIDEO_STREAM
import org.schabi.newpipe.util.Localization
import org.schabi.newpipe.util.PicassoHelper
import org.schabi.newpipe.util.StreamTypeUtil
import java.util.concurrent.TimeUnit
data class StreamItem(
@ -58,8 +59,6 @@ data class StreamItem(
viewBinding.itemVideoTitleView.text = stream.title
viewBinding.itemUploaderView.text = stream.uploader
val isLiveStream = stream.streamType == LIVE_STREAM || stream.streamType == AUDIO_LIVE_STREAM
if (stream.duration > 0) {
viewBinding.itemDurationView.text = Localization.getDurationString(stream.duration)
viewBinding.itemDurationView.setBackgroundColor(
@ -77,7 +76,7 @@ data class StreamItem(
} else {
viewBinding.itemProgressView.visibility = View.GONE
}
} else if (isLiveStream) {
} else if (StreamTypeUtil.isLiveStream(stream.streamType)) {
viewBinding.itemDurationView.setText(R.string.duration_live)
viewBinding.itemDurationView.setBackgroundColor(
ContextCompat.getColor(