diff --git a/app/build.gradle b/app/build.gradle
index 319469cab..9067f4ccd 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -1,3 +1,5 @@
+import java.time.Instant
+
plugins {
id 'com.android.application'
id 'kotlin-android'
@@ -25,9 +27,8 @@ android {
// use the date as version for debug builds
if (variant.name == 'debug') {
variant.outputs.each { output ->
- def date = getDate()
- output.versionCodeOverride = date
- output.versionNameOverride = date
+ output.versionCodeOverride = getUnixTime()
+ output.versionNameOverride = getUnixTime()
}
}
}
@@ -104,8 +105,6 @@ dependencies {
implementation libs.coil
}
-static def getDate() {
- def date = new Date()
- def formattedDate = date.format('yyyyMMddHH')
- return Integer.parseInt(formattedDate)
+static def getUnixTime() {
+ return Instant.now().getEpochSecond()
}
\ No newline at end of file
diff --git a/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt b/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt
index 31d7a2cdf..410edf4da 100644
--- a/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt
+++ b/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt
@@ -118,6 +118,7 @@ class PlayerFragment : Fragment() {
private var playlistId: String? = null
private var channelId: String? = null
private var isSubscribed: Boolean = false
+ private var isLive = false
/**
* for the transition
@@ -522,7 +523,6 @@ class PlayerFragment : Fragment() {
val playbackSpeedValues =
context?.resources?.getStringArray(R.array.playbackSpeedValues)!!
exoPlayer.setPlaybackSpeed(playbackSpeed.toFloat())
- Log.e(TAG, playbackSpeed)
val speedIndex = playbackSpeedValues.indexOf(playbackSpeed)
playerBinding.speedText.text = playbackSpeeds[speedIndex]
@@ -769,6 +769,12 @@ class PlayerFragment : Fragment() {
// save related streams for autoplay
relatedStreams = response.relatedStreams
+ // duration that's not greater than 0 indicates that the video is live
+ if (!(response.duration!! > 0)) {
+ isLive = true
+ handleLiveVideo()
+ }
+
runOnUiThread {
// set media sources for the player
setResolutionAndSubtitles(response)
@@ -793,6 +799,11 @@ class PlayerFragment : Fragment() {
run()
}
+ private fun handleLiveVideo() {
+ playerBinding.exoTime.visibility = View.GONE
+ playerBinding.liveLL.visibility = View.VISIBLE
+ }
+
private fun seekToWatchPosition() {
// seek to saved watch position if available
val watchPositions = PreferenceHelper.getWatchPositions()
diff --git a/app/src/main/res/layout/exo_styled_player_control_view.xml b/app/src/main/res/layout/exo_styled_player_control_view.xml
index d7cdd9e77..90ecdcc1c 100644
--- a/app/src/main/res/layout/exo_styled_player_control_view.xml
+++ b/app/src/main/res/layout/exo_styled_player_control_view.xml
@@ -185,6 +185,29 @@
+
+
+
+
+
+
+
+
+
+