Add TV track support and remembering audio track :)

This commit is contained in:
Blatzar 2022-08-29 13:14:36 +02:00
parent 60968f2244
commit e855ccfb25
4 changed files with 368 additions and 347 deletions

View file

@ -221,6 +221,7 @@ class CS3IPlayer : IPlayer {
} }
override fun setExoplayerAudioTrack(trackLanguage: String?) { override fun setExoplayerAudioTrack(trackLanguage: String?) {
preferredAudioTrackLanguage = trackLanguage
exoPlayer?.trackSelectionParameters = exoPlayer?.trackSelectionParameters exoPlayer?.trackSelectionParameters = exoPlayer?.trackSelectionParameters
?.buildUpon() ?.buildUpon()
?.setPreferredAudioLanguage(trackLanguage) ?.setPreferredAudioLanguage(trackLanguage)
@ -374,6 +375,12 @@ class CS3IPlayer : IPlayer {
} }
companion object { companion object {
/**
* Fuck it, does not reset after player exit, people probably want that.
* It will default to the first audio track if the language does not exist anyways.
* // TODO using setKey?
**/
private var preferredAudioTrackLanguage: String? = null
private var simpleCache: SimpleCache? = null private var simpleCache: SimpleCache? = null
var requestSubtitleUpdate: (() -> Unit)? = null var requestSubtitleUpdate: (() -> Unit)? = null
@ -491,7 +498,11 @@ class CS3IPlayer : IPlayer {
.setRendererDisabled(C.TRACK_TYPE_TEXT, true) .setRendererDisabled(C.TRACK_TYPE_TEXT, true)
.setTunnelingEnabled(true) .setTunnelingEnabled(true)
.setDisabledTextTrackSelectionFlags(C.TRACK_TYPE_TEXT) .setDisabledTextTrackSelectionFlags(C.TRACK_TYPE_TEXT)
.clearSelectionOverrides() .clearVideoSizeConstraints()
.setPreferredAudioLanguage(preferredAudioTrackLanguage)
// This would also clear preferred audio
// .clearSelectionOverrides()
.build() .build()
return trackSelector return trackSelector
} }

View file

@ -116,15 +116,15 @@ class M3u8Helper {
return !url.contains("https://") && !url.contains("http://") return !url.contains("https://") && !url.contains("http://")
} }
suspend fun m3u8Generation(m3u8: M3u8Stream, returnThis: Boolean?): List<M3u8Stream> { suspend fun m3u8Generation(m3u8: M3u8Stream, returnThis: Boolean? = true): List<M3u8Stream> {
val list = mutableListOf<M3u8Stream>() val list = mutableListOf<M3u8Stream>()
val m3u8Parent = getParentLink(m3u8.streamUrl) val m3u8Parent = getParentLink(m3u8.streamUrl)
val response = app.get(m3u8.streamUrl, headers = m3u8.headers, verify = false).text val response = app.get(m3u8.streamUrl, headers = m3u8.headers, verify = false).text
var hasAnyContent = false // var hasAnyContent = false
for (match in QUALITY_REGEX.findAll(response)) { for (match in QUALITY_REGEX.findAll(response)) {
hasAnyContent = true // hasAnyContent = true
var (quality, m3u8Link, m3u8Link2) = match.destructured var (quality, m3u8Link, m3u8Link2) = match.destructured
if (m3u8Link.isEmpty()) m3u8Link = m3u8Link2 if (m3u8Link.isEmpty()) m3u8Link = m3u8Link2
if (absoluteExtensionDetermination(m3u8Link) == "m3u8") { if (absoluteExtensionDetermination(m3u8Link) == "m3u8") {
@ -141,16 +141,14 @@ class M3u8Helper {
m3u8.headers m3u8.headers
), false ), false
) )
} }
list += M3u8Stream( list += M3u8Stream(
m3u8Link, m3u8Link,
quality.toIntOrNull(), quality.toIntOrNull(),
m3u8.headers m3u8.headers
) )
} }
if (returnThis ?: !hasAnyContent) { if (returnThis != false) {
list += M3u8Stream( list += M3u8Stream(
m3u8.streamUrl, m3u8.streamUrl,
Qualities.Unknown.value, Qualities.Unknown.value,
@ -169,7 +167,10 @@ class M3u8Helper {
val errored: Boolean = false val errored: Boolean = false
) )
suspend fun hlsYield(qualities: List<M3u8Stream>, startIndex: Int = 0): Iterator<HlsDownloadData> { suspend fun hlsYield(
qualities: List<M3u8Stream>,
startIndex: Int = 0
): Iterator<HlsDownloadData> {
if (qualities.isEmpty()) return listOf( if (qualities.isEmpty()) return listOf(
HlsDownloadData( HlsDownloadData(
byteArrayOf(), byteArrayOf(),

View file

@ -1,131 +1,131 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:id="@+id/player_background"
android:layout_height="match_parent" android:layout_width="match_parent"
android:orientation="horizontal" android:layout_height="match_parent"
android:keepScreenOn="true" android:background="@android:color/black"
android:id="@+id/player_background" android:keepScreenOn="true"
app:backgroundTint="@android:color/black" android:orientation="horizontal"
android:background="@android:color/black" android:screenOrientation="sensorLandscape"
android:screenOrientation="sensorLandscape" app:backgroundTint="@android:color/black"
app:surface_type="texture_view"> app:surface_type="texture_view">
<!-- <!--
app:fastforward_increment="10000" app:fastforward_increment="10000"
app:rewind_increment="10000"--> app:rewind_increment="10000"-->
<com.google.android.exoplayer2.ui.PlayerView <com.google.android.exoplayer2.ui.PlayerView
android:id="@+id/player_view" android:id="@+id/player_view"
app:show_timeout="0" android:layout_width="match_parent"
app:hide_on_touch="false" android:layout_height="match_parent"
app:auto_show="true" app:auto_show="true"
android:layout_width="match_parent" app:controller_layout_id="@layout/player_custom_layout_tv"
android:layout_height="match_parent" app:hide_on_touch="false"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:controller_layout_id="@layout/player_custom_layout_tv" /> app:show_timeout="0" />
<FrameLayout <FrameLayout
app:layout_constraintBottom_toBottomOf="parent" android:id="@+id/player_loading_overlay"
app:layout_constraintEnd_toEndOf="parent" android:layout_width="match_parent"
app:layout_constraintStart_toStartOf="parent" android:layout_height="match_parent"
app:layout_constraintTop_toTopOf="parent" android:background="@android:color/black"
android:layout_width="match_parent" android:backgroundTint="@android:color/black"
android:layout_height="match_parent" app:layout_constraintBottom_toBottomOf="parent"
android:id="@+id/player_loading_overlay" app:layout_constraintEnd_toEndOf="parent"
android:background="@android:color/black" app:layout_constraintStart_toStartOf="parent"
android:backgroundTint="@android:color/black"> app:layout_constraintTop_toTopOf="parent">
<com.google.android.material.button.MaterialButton <com.google.android.material.button.MaterialButton
android:nextFocusUp="@id/player_loading_go_back" android:id="@+id/overlay_loading_skip_button"
android:nextFocusLeft="@id/player_loading_go_back" style="@style/VideoButtonTV"
tools:visibility="visible" android:layout_width="wrap_content"
android:visibility="gone" android:layout_gravity="center"
android:layout_marginTop="70dp" android:layout_marginTop="70dp"
android:layout_gravity="center" android:clickable="true"
android:id="@+id/overlay_loading_skip_button" android:focusable="true"
android:text="@string/skip_loading" android:focusableInTouchMode="true"
android:focusable="true" android:nextFocusLeft="@id/player_loading_go_back"
android:clickable="true" android:nextFocusUp="@id/player_loading_go_back"
android:focusableInTouchMode="true" android:text="@string/skip_loading"
app:icon="@drawable/ic_baseline_skip_next_24" android:visibility="gone"
style="@style/VideoButtonTV" app:icon="@drawable/ic_baseline_skip_next_24"
android:layout_width="wrap_content" /> tools:visibility="visible" />
<ProgressBar <ProgressBar
android:layout_width="50dp" android:id="@+id/main_load"
android:layout_height="50dp" android:layout_width="50dp"
android:layout_gravity="center" android:layout_height="50dp"
android:id="@+id/main_load" /> android:layout_gravity="center" />
<FrameLayout <FrameLayout
android:id="@+id/video_go_back_holder_holder" android:id="@+id/video_go_back_holder_holder"
android:layout_margin="5dp" android:layout_width="wrap_content"
app:layout_constraintStart_toStartOf="parent" android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent" android:layout_margin="5dp"
android:layout_width="wrap_content" app:layout_constraintStart_toStartOf="parent"
android:layout_height="wrap_content"> app:layout_constraintTop_toTopOf="parent">
<ImageView <ImageView
android:layout_width="30dp" android:layout_width="30dp"
android:layout_height="30dp" android:layout_height="30dp"
android:layout_gravity="center" android:layout_gravity="center"
android:src="@drawable/ic_baseline_arrow_back_24" android:src="@drawable/ic_baseline_arrow_back_24"
app:tint="@android:color/white" /> app:tint="@android:color/white" />
<ImageView <ImageView
android:nextFocusRight="@id/overlay_loading_skip_button" android:id="@+id/player_loading_go_back"
android:nextFocusDown="@id/overlay_loading_skip_button" android:layout_width="70dp"
android:focusableInTouchMode="true" android:layout_height="70dp"
android:id="@+id/player_loading_go_back" android:layout_gravity="center"
android:layout_width="70dp" android:background="@drawable/video_tap_button_always_white"
android:layout_height="70dp" android:clickable="true"
android:layout_gravity="center" android:focusable="true"
android:focusable="true" android:focusableInTouchMode="true"
android:clickable="true" android:nextFocusRight="@id/overlay_loading_skip_button"
android:background="@drawable/video_tap_button_always_white" /> android:nextFocusDown="@id/overlay_loading_skip_button" />
</FrameLayout> </FrameLayout>
</FrameLayout> </FrameLayout>
<FrameLayout <FrameLayout
android:visibility="gone" android:id="@+id/player_torrent_info"
android:paddingStart="20dp" android:layout_width="match_parent"
android:paddingEnd="20dp" android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent" android:paddingStart="20dp"
app:layout_constraintEnd_toEndOf="parent" android:paddingEnd="20dp"
app:layout_constraintStart_toStartOf="parent" android:visibility="gone"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent"
android:id="@+id/player_torrent_info" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/video_torrent_progress"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:gravity="start"
android:textColor="@color/white"
android:textStyle="bold"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="78% at 18kb/s" />
<TextView <TextView
android:layout_width="match_parent" android:id="@+id/video_torrent_seeders"
android:layout_height="wrap_content" android:layout_width="match_parent"
app:layout_constraintTop_toTopOf="parent" android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent" android:layout_marginTop="0dp"
android:gravity="start" android:gravity="start"
android:layout_marginTop="15dp" android:textColor="@color/white"
android:textStyle="bold" app:layout_constraintLeft_toLeftOf="parent"
android:textColor="@color/white" app:layout_constraintTop_toBottomOf="@+id/player_video_title"
android:id="@+id/video_torrent_progress" tools:text="17 seeders" />
tools:text="78% at 18kb/s" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"
android:gravity="start"
android:layout_marginTop="0dp"
android:textColor="@color/white"
android:id="@+id/video_torrent_seeders"
tools:text="17 seeders"
app:layout_constraintTop_toBottomOf="@+id/player_video_title" />
</FrameLayout> </FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -1,24 +1,24 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/player_holder" android:id="@+id/player_holder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical" android:orientation="vertical"
android:screenOrientation="landscape" android:screenOrientation="landscape"
tools:orientation="vertical" android:tag="television"
android:tag="television"> tools:orientation="vertical">
<FrameLayout <FrameLayout
android:id="@+id/subtitle_holder" android:id="@+id/subtitle_holder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<View <View
android:id="@+id/shadow_overlay" android:id="@+id/shadow_overlay"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@drawable/player_gradient_tv" /> android:background="@drawable/player_gradient_tv" />
</FrameLayout> </FrameLayout>
<!-- <!--
<LinearLayout android:layout_width="match_parent" <LinearLayout android:layout_width="match_parent"
@ -56,40 +56,40 @@
--> -->
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/player_video_holder" android:id="@+id/player_video_holder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:padding="16dp"> android:padding="16dp">
<FrameLayout <FrameLayout
android:id="@+id/player_top_holder" android:id="@+id/player_top_holder"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/player_video_title"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="wrap_content"
android:layout_marginStart="80dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="32dp"
android:gravity="end"
android:textColor="@color/white"
android:textSize="16sp"
android:textStyle="bold"
tools:text="Hello world" />
<TextView <TextView
android:id="@+id/player_video_title" android:id="@+id/player_video_title_rez"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="80dp" android:layout_marginStart="80dp"
android:layout_marginTop="20dp" android:layout_marginTop="40dp"
android:layout_marginEnd="32dp" android:layout_marginEnd="32dp"
android:gravity="end" android:gravity="end"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="16sp" android:textSize="16sp"
android:textStyle="bold" tools:text="1920x1080" />
tools:text="Hello world" />
<TextView
android:id="@+id/player_video_title_rez"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="80dp"
android:layout_marginTop="40dp"
android:layout_marginEnd="32dp"
android:gravity="end"
android:textColor="@color/white"
android:textSize="16sp"
tools:text="1920x1080" />
<!-- Removed as it has no use anymore--> <!-- Removed as it has no use anymore-->
<!--<androidx.mediarouter.app.MediaRouteButton <!--<androidx.mediarouter.app.MediaRouteButton
@ -104,262 +104,271 @@
app:layout_constraintTop_toTopOf="parent" />--> app:layout_constraintTop_toTopOf="parent" />-->
<FrameLayout <FrameLayout
android:id="@+id/player_go_back_holder" android:id="@+id/player_go_back_holder"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="5dp" android:layout_margin="5dp"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"> app:layout_constraintTop_toTopOf="parent">
<ImageView <ImageView
android:layout_width="30dp" android:layout_width="30dp"
android:layout_height="30dp" android:layout_height="30dp"
android:layout_gravity="center" android:layout_gravity="center"
android:src="@drawable/ic_baseline_arrow_back_24" android:contentDescription="@string/go_back_img_des"
app:tint="@android:color/white" android:src="@drawable/ic_baseline_arrow_back_24"
android:contentDescription="@string/go_back_img_des" /> app:tint="@android:color/white" />
<ImageView <ImageView
android:id="@+id/player_go_back" android:id="@+id/player_go_back"
android:layout_width="70dp" android:layout_width="70dp"
android:layout_height="70dp" android:layout_height="70dp"
android:layout_gravity="center" android:layout_gravity="center"
android:background="@drawable/video_tap_button_always_white" android:background="@drawable/video_tap_button_always_white"
android:clickable="true" android:clickable="true"
android:contentDescription="@string/go_back_img_des" android:contentDescription="@string/go_back_img_des"
android:focusable="true" /> android:focusable="true" />
</FrameLayout> </FrameLayout>
</FrameLayout> </FrameLayout>
<!--use for thinner app:trackThickness="3dp" com.google.android.material.progressindicator.CircularProgressIndicator--> <!--use for thinner app:trackThickness="3dp" com.google.android.material.progressindicator.CircularProgressIndicator-->
<ProgressBar <ProgressBar
android:id="@+id/player_buffering" android:id="@+id/player_buffering"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:clickable="false" android:clickable="false"
android:focusable="false" android:focusable="false"
android:focusableInTouchMode="false" android:focusableInTouchMode="false"
android:indeterminate="true" android:indeterminate="true"
android:visibility="gone" android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
tools:visibility="visible" /> tools:visibility="visible" />
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:layout_marginBottom="20dp" android:layout_marginBottom="20dp"
android:gravity="center" android:gravity="center"
android:orientation="horizontal" android:orientation="horizontal"
android:paddingTop="4dp" android:paddingTop="4dp"
android:visibility="gone" android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"> app:layout_constraintEnd_toEndOf="parent">
<ImageButton <ImageButton
android:id="@id/exo_prev" android:id="@id/exo_prev"
style="@style/ExoMediaButton.Previous" style="@style/ExoMediaButton.Previous"
android:tintMode="src_in" android:tintMode="src_in"
app:tint="?attr/colorPrimaryDark" app:tint="?attr/colorPrimaryDark"
tools:ignore="ContentDescription" /> tools:ignore="ContentDescription" />
<ImageButton <ImageButton
android:id="@id/exo_repeat_toggle" android:id="@id/exo_repeat_toggle"
style="@style/ExoMediaButton" style="@style/ExoMediaButton"
android:tintMode="src_in" android:tintMode="src_in"
app:tint="?attr/colorPrimaryDark" app:tint="?attr/colorPrimaryDark"
tools:ignore="ContentDescription" /> tools:ignore="ContentDescription" />
<ImageButton <ImageButton
android:id="@id/exo_next" android:id="@id/exo_next"
style="@style/ExoMediaButton.Next" style="@style/ExoMediaButton.Next"
android:tintMode="src_in" android:tintMode="src_in"
app:tint="?attr/colorPrimaryDark" app:tint="?attr/colorPrimaryDark"
tools:ignore="ContentDescription" /> tools:ignore="ContentDescription" />
<ImageButton <ImageButton
android:id="@id/exo_vr" android:id="@id/exo_vr"
style="@style/ExoMediaButton.VR" style="@style/ExoMediaButton.VR"
android:tintMode="src_in" android:tintMode="src_in"
app:tint="?attr/colorPrimaryDark" app:tint="?attr/colorPrimaryDark"
tools:ignore="ContentDescription" /> tools:ignore="ContentDescription" />
<ImageButton <ImageButton
android:id="@id/exo_play" android:id="@id/exo_play"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="0dp"
android:tintMode="src_in" android:tintMode="src_in"
app:tint="?attr/colorPrimaryDark" app:tint="?attr/colorPrimaryDark"
tools:ignore="ContentDescription" /> tools:ignore="ContentDescription" />
<ImageButton <ImageButton
android:id="@id/exo_pause" android:id="@id/exo_pause"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="0dp"
android:tintMode="src_in" android:tintMode="src_in"
app:tint="?attr/colorPrimaryDark" app:tint="?attr/colorPrimaryDark"
tools:ignore="ContentDescription" /> tools:ignore="ContentDescription" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/bottom_player_bar" android:id="@+id/bottom_player_bar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="64dp" android:layout_marginStart="64dp"
android:layout_marginEnd="64dp" android:layout_marginEnd="64dp"
android:layout_marginBottom="10dp" android:layout_marginBottom="10dp"
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="vertical" android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"> app:layout_constraintStart_toStartOf="parent">
<LinearLayout <LinearLayout
android:id="@+id/player_video_bar" android:id="@+id/player_video_bar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layoutDirection="ltr" android:layoutDirection="ltr"
android:orientation="horizontal"> android:orientation="horizontal">
<ImageView <ImageView
android:id="@+id/player_pause_play" android:id="@+id/player_pause_play"
android:layout_width="30dp" android:layout_width="30dp"
android:layout_height="30dp" android:layout_height="30dp"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_marginStart="20dp" android:layout_marginStart="20dp"
android:background="@drawable/video_tap_button" android:background="@drawable/video_tap_button"
android:focusable="true" android:focusable="true"
android:focusableInTouchMode="true" android:focusableInTouchMode="true"
android:nextFocusUp="@id/player_go_back" android:nextFocusUp="@id/player_go_back"
android:nextFocusDown="@id/player_lock" android:nextFocusDown="@id/player_lock"
android:src="@drawable/netflix_pause" android:src="@drawable/netflix_pause"
app:tint="@color/player_button_tv" app:tint="@color/player_button_tv"
tools:ignore="ContentDescription" /> tools:ignore="ContentDescription" />
<TextView <TextView
android:id="@id/exo_position" android:id="@id/exo_position"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:gravity="end" android:gravity="end"
android:includeFontPadding="false" android:includeFontPadding="false"
android:minWidth="50dp" android:minWidth="50dp"
android:paddingLeft="4dp" android:paddingLeft="4dp"
android:paddingRight="4dp" android:paddingRight="4dp"
android:textColor="@android:color/white" android:textColor="@android:color/white"
android:textSize="14sp" android:textSize="14sp"
android:textStyle="normal" android:textStyle="normal"
tools:text="15:30" /> tools:text="15:30" />
<!--app:buffered_color="@color/videoCache"--> <!--app:buffered_color="@color/videoCache"-->
<com.google.android.exoplayer2.ui.DefaultTimeBar <com.google.android.exoplayer2.ui.DefaultTimeBar
android:id="@id/exo_progress" android:id="@id/exo_progress"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="30dp" android:layout_height="30dp"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_weight="1" android:layout_weight="1"
android:focusable="false" android:focusable="false"
android:focusableInTouchMode="false" android:focusableInTouchMode="false"
app:bar_height="2dp" app:bar_height="2dp"
app:played_color="?attr/colorPrimary" app:played_color="?attr/colorPrimary"
app:scrubber_color="?attr/colorPrimary" app:scrubber_color="?attr/colorPrimary"
app:scrubber_dragged_size="26dp" app:scrubber_dragged_size="26dp"
app:scrubber_enabled_size="24dp" app:scrubber_enabled_size="24dp"
app:unplayed_color="@color/videoProgress" /> app:unplayed_color="@color/videoProgress" />
<!-- exo_duration--> <!-- exo_duration-->
<TextView <TextView
android:id="@id/exo_duration" android:id="@id/exo_duration"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_marginEnd="20dp" android:layout_marginEnd="20dp"
android:includeFontPadding="false" android:includeFontPadding="false"
android:minWidth="50dp" android:minWidth="50dp"
android:paddingLeft="4dp" android:paddingLeft="4dp"
android:paddingRight="4dp" android:paddingRight="4dp"
android:textColor="@android:color/white" android:textColor="@android:color/white"
android:textSize="14sp" android:textSize="14sp"
android:textStyle="normal" android:textStyle="normal"
tools:text="23:20" /> tools:text="23:20" />
</LinearLayout> </LinearLayout>
<HorizontalScrollView <HorizontalScrollView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center"> android:layout_gravity="center">
<LinearLayout <LinearLayout
android:id="@+id/player_lock_holder" android:id="@+id/player_lock_holder"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="horizontal"> android:orientation="horizontal">
<com.google.android.material.button.MaterialButton <com.google.android.material.button.MaterialButton
android:id="@+id/player_resize_btt" android:id="@+id/player_resize_btt"
style="@style/VideoButtonTV" style="@style/VideoButtonTV"
android:nextFocusLeft="@id/player_lock" android:nextFocusLeft="@id/player_lock"
android:nextFocusRight="@id/player_speed_btt" android:nextFocusRight="@id/player_speed_btt"
android:nextFocusUp="@id/player_pause_play" android:nextFocusUp="@id/player_pause_play"
android:text="@string/video_aspect_ratio_resize" android:text="@string/video_aspect_ratio_resize"
app:icon="@drawable/ic_baseline_aspect_ratio_24" /> app:icon="@drawable/ic_baseline_aspect_ratio_24" />
<com.google.android.material.button.MaterialButton <com.google.android.material.button.MaterialButton
android:id="@+id/player_speed_btt" android:id="@+id/player_speed_btt"
style="@style/VideoButtonTV" style="@style/VideoButtonTV"
android:nextFocusLeft="@id/player_resize_btt" android:nextFocusLeft="@id/player_resize_btt"
android:nextFocusRight="@id/player_subtitle_offset_btt" android:nextFocusRight="@id/player_subtitle_offset_btt"
android:nextFocusUp="@id/player_pause_play" android:nextFocusUp="@id/player_pause_play"
app:icon="@drawable/ic_baseline_speed_24" app:icon="@drawable/ic_baseline_speed_24"
tools:text="Speed" /> tools:text="Speed" />
<com.google.android.material.button.MaterialButton <com.google.android.material.button.MaterialButton
android:visibility="gone" android:id="@+id/player_subtitle_offset_btt"
tools:visibility="visible" style="@style/VideoButtonTV"
android:id="@+id/player_subtitle_offset_btt" android:nextFocusLeft="@id/player_speed_btt"
style="@style/VideoButtonTV" android:nextFocusRight="@id/player_sources_btt"
android:nextFocusLeft="@id/player_speed_btt" android:text="@string/subtitle_offset"
android:nextFocusRight="@id/player_sources_btt" android:visibility="gone"
app:icon="@drawable/ic_outline_subtitles_24" app:icon="@drawable/ic_outline_subtitles_24"
android:text="@string/subtitle_offset"/> tools:visibility="visible" />
<com.google.android.material.button.MaterialButton <com.google.android.material.button.MaterialButton
android:id="@+id/player_sources_btt" android:id="@+id/player_sources_btt"
style="@style/VideoButtonTV" style="@style/VideoButtonTV"
android:nextFocusLeft="@id/player_subtitle_offset_btt" android:nextFocusLeft="@id/player_subtitle_offset_btt"
android:nextFocusRight="@id/player_skip_op" android:nextFocusRight="@id/player_tracks_btt"
android:nextFocusUp="@id/player_pause_play" android:nextFocusUp="@id/player_pause_play"
android:text="@string/video_source" android:text="@string/video_source"
app:icon="@drawable/ic_baseline_playlist_play_24" /> app:icon="@drawable/ic_baseline_playlist_play_24" />
<com.google.android.material.button.MaterialButton <com.google.android.material.button.MaterialButton
android:id="@+id/player_skip_op" android:id="@+id/player_tracks_btt"
style="@style/VideoButtonTV" style="@style/VideoButtonTV"
android:nextFocusLeft="@id/player_sources_btt" android:nextFocusLeft="@id/player_sources_btt"
android:nextFocusRight="@id/player_skip_episode" android:nextFocusRight="@id/player_skip_op"
android:nextFocusUp="@id/player_pause_play" android:nextFocusUp="@id/player_pause_play"
android:text="@string/video_skip_op" android:text="@string/tracks"
app:icon="@drawable/ic_baseline_fast_forward_24" /> app:icon="@drawable/ic_baseline_playlist_play_24" />
<com.google.android.material.button.MaterialButton <com.google.android.material.button.MaterialButton
android:id="@+id/player_skip_episode" android:id="@+id/player_skip_op"
style="@style/VideoButtonTV" style="@style/VideoButtonTV"
android:nextFocusLeft="@id/player_sources_btt"
android:nextFocusRight="@id/player_skip_episode"
android:nextFocusUp="@id/player_pause_play"
android:text="@string/video_skip_op"
app:icon="@drawable/ic_baseline_fast_forward_24" />
android:nextFocusLeft="@id/player_skip_op" <com.google.android.material.button.MaterialButton
android:nextFocusRight="@id/player_lock" android:id="@+id/player_skip_episode"
android:nextFocusUp="@id/player_pause_play" style="@style/VideoButtonTV"
android:text="@string/next_episode"
app:icon="@drawable/ic_baseline_skip_next_24" /> android:nextFocusLeft="@id/player_skip_op"
android:nextFocusRight="@id/player_lock"
android:nextFocusUp="@id/player_pause_play"
android:text="@string/next_episode"
app:icon="@drawable/ic_baseline_skip_next_24" />
</LinearLayout> </LinearLayout>
</HorizontalScrollView> </HorizontalScrollView>
</LinearLayout> </LinearLayout>