mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-01-06 01:20:29 +05:30
indicate time difference
This commit is contained in:
parent
11b568d0b6
commit
3dfd0ba562
@ -19,6 +19,7 @@ import android.os.PowerManager
|
|||||||
import android.support.v4.media.session.MediaSessionCompat
|
import android.support.v4.media.session.MediaSessionCompat
|
||||||
import android.text.Html
|
import android.text.Html
|
||||||
import android.text.TextUtils
|
import android.text.TextUtils
|
||||||
|
import android.text.format.DateUtils
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.MotionEvent
|
import android.view.MotionEvent
|
||||||
@ -1020,9 +1021,18 @@ class PlayerFragment : Fragment() {
|
|||||||
)
|
)
|
||||||
|
|
||||||
// switch back to normal speed when on the end of live stream
|
// switch back to normal speed when on the end of live stream
|
||||||
if (isLive && (exoPlayer.duration - exoPlayer.duration < 0.5)) {
|
Log.e(exoPlayer.duration.toString(), exoPlayer.currentPosition.toString())
|
||||||
|
if (isLive && (exoPlayer.duration - exoPlayer.currentPosition < 10000)) {
|
||||||
exoPlayer.setPlaybackSpeed(1F)
|
exoPlayer.setPlaybackSpeed(1F)
|
||||||
playerBinding.speedText.text = "1x"
|
playerBinding.speedText.text = "1x"
|
||||||
|
playerBinding.liveSeparator.visibility = View.GONE
|
||||||
|
playerBinding.liveDiff.text = ""
|
||||||
|
} else if (isLive) {
|
||||||
|
Log.e(TAG, "changing the time")
|
||||||
|
// live stream but not watching at the end/live position
|
||||||
|
playerBinding.liveSeparator.visibility = View.VISIBLE
|
||||||
|
val diffText = DateUtils.formatElapsedTime((exoPlayer.duration - exoPlayer.currentPosition) / 1000)
|
||||||
|
playerBinding.liveDiff.text = "-$diffText"
|
||||||
}
|
}
|
||||||
// check if video has ended, next video is available and autoplay is enabled.
|
// check if video has ended, next video is available and autoplay is enabled.
|
||||||
else if (
|
else if (
|
||||||
|
@ -195,16 +195,17 @@
|
|||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/liveDiff"
|
android:id="@+id/liveDiff"
|
||||||
style="@style/ExoStyledControls.TimeText.Position"
|
style="@style/ExoStyledControls.TimeText.Duration" />
|
||||||
android:visibility="gone"/>
|
|
||||||
|
|
||||||
<TextView style="@style/ExoStyledControls.TimeText.Separator"
|
<TextView
|
||||||
|
android:id="@+id/liveSeparator"
|
||||||
|
style="@style/ExoStyledControls.TimeText.Separator"
|
||||||
android:visibility="gone"/>
|
android:visibility="gone"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/liveIndicator"
|
android:id="@+id/liveIndicator"
|
||||||
android:text="@string/live"
|
android:text="@string/live"
|
||||||
style="@style/ExoStyledControls.TimeText.Duration" />
|
style="@style/ExoStyledControls.TimeText.Position" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user