mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-28 16:00:31 +05:30
Merge pull request #6694 from Bnyro/master
fix: hide download buttons when current video is live
This commit is contained in:
commit
e25e68df87
@ -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(
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1136,6 +1136,7 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions {
|
||||
streams.uploaderSubscriberCount.formatShort()
|
||||
)
|
||||
player.isLive = streams.livestream
|
||||
relPlayerDownload.isVisible = !streams.livestream
|
||||
}
|
||||
playerBinding.exoTitle.text = streams.title
|
||||
|
||||
|
@ -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]) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user