Merge pull request #6694 from Bnyro/master

fix: hide download buttons when current video is live
This commit is contained in:
Bnyro 2024-11-04 17:00:54 +01:00 committed by GitHub
commit e25e68df87
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 9 additions and 2 deletions

View File

@ -24,7 +24,7 @@ data class StreamItem(
val shortDescription: String? = null,
val isShort: Boolean = false
) : Parcelable {
val isLive get() = (duration != null) && (duration <= 0L)
val isLive get() = (duration == null) || (duration <= 0L)
fun toLocalPlaylistItem(playlistId: String): LocalPlaylistItem {
return LocalPlaylistItem(

View File

@ -21,6 +21,8 @@ data class WatchHistoryItem(
@ColumnInfo val duration: Long? = null,
@ColumnInfo val isShort: Boolean = false
) {
val isLive get() = (duration == null) || (duration <= 0L)
fun toStreamItem() = StreamItem(
url = videoId,
type = StreamItem.TYPE_STREAM,

View File

@ -92,7 +92,10 @@ class WatchHistoryAdapter(
true
}
if (video.duration != null) watchProgress.setWatchProgressLength(video.videoId, video.duration)
if (video.duration != null) watchProgress.setWatchProgressLength(
video.videoId,
video.duration
)
}
}
}

View File

@ -1136,6 +1136,7 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions {
streams.uploaderSubscriberCount.formatShort()
)
player.isLive = streams.livestream
relPlayerDownload.isVisible = !streams.livestream
}
playerBinding.exoTitle.text = streams.title

View File

@ -52,6 +52,7 @@ class VideoOptionsBottomSheet : BaseBottomSheet() {
}
optionsList += listOf(R.string.addToPlaylist, R.string.download, R.string.share)
if (streamItem.isLive) optionsList.remove(R.string.download)
setSimpleItems(optionsList.map { getString(it) }) { which ->
when (optionsList[which]) {