mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-13 22:00:30 +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.text.Html
|
||||
import android.text.TextUtils
|
||||
import android.text.format.DateUtils
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.MotionEvent
|
||||
@ -1020,9 +1021,18 @@ class PlayerFragment : Fragment() {
|
||||
)
|
||||
|
||||
// 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)
|
||||
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.
|
||||
else if (
|
||||
|
@ -195,16 +195,17 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/liveDiff"
|
||||
style="@style/ExoStyledControls.TimeText.Position"
|
||||
android:visibility="gone"/>
|
||||
style="@style/ExoStyledControls.TimeText.Duration" />
|
||||
|
||||
<TextView style="@style/ExoStyledControls.TimeText.Separator"
|
||||
<TextView
|
||||
android:id="@+id/liveSeparator"
|
||||
style="@style/ExoStyledControls.TimeText.Separator"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/liveIndicator"
|
||||
android:text="@string/live"
|
||||
style="@style/ExoStyledControls.TimeText.Duration" />
|
||||
style="@style/ExoStyledControls.TimeText.Position" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user