Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -375,12 +375,7 @@ open class FullScreenPlayer : AbstractPlayerFragment() {
start()
}
}
playerBinding?.playerVideoTitleRez?.let {
ObjectAnimator.ofFloat(it, "translationY", titleMove).apply {
duration = 200
start()
}
}

playerBinding?.playerVideoInfo?.let {
ObjectAnimator.ofFloat(it, "translationY", titleMove).apply {
duration = 200
Expand Down Expand Up @@ -931,7 +926,6 @@ open class FullScreenPlayer : AbstractPlayerFragment() {
// video_bar.startAnimation(fadeAnimation)

// TITLE
playerVideoTitleRez.startAnimation(fadeAnimation)
playerVideoInfo.startAnimation(fadeAnimation)
playerEpisodeFiller.startAnimation(fadeAnimation)
playerVideoTitleHolder.startAnimation(fadeAnimation)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ import com.lagradost.cloudstream3.ui.result.ResultFragment
import com.lagradost.cloudstream3.ui.result.ResultViewModel2
import com.lagradost.cloudstream3.ui.result.setLinearListLayout
import com.lagradost.cloudstream3.ui.result.SyncViewModel
import com.lagradost.cloudstream3.ui.result.VideoWatchState
import com.lagradost.cloudstream3.ui.settings.Globals.EMULATOR
import com.lagradost.cloudstream3.ui.settings.Globals.isLayout
import com.lagradost.cloudstream3.ui.settings.Globals.PHONE
Expand All @@ -102,15 +101,12 @@ import com.lagradost.cloudstream3.utils.Coroutines.ioSafe
import com.lagradost.cloudstream3.utils.Coroutines.runOnMainThread
import com.lagradost.cloudstream3.utils.DataStoreHelper
import com.lagradost.cloudstream3.utils.DataStoreHelper.getViewPos
import com.lagradost.cloudstream3.utils.DataStoreHelper.setVideoWatchState
import com.lagradost.cloudstream3.utils.EpisodeSkip
import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.ExtractorLinkType
import com.lagradost.cloudstream3.utils.Qualities
import com.lagradost.cloudstream3.utils.setText
import com.lagradost.cloudstream3.utils.SingleSelectionHelper.showDialog
import com.lagradost.cloudstream3.utils.SubtitleHelper.fromCodeToLangTagIETF
import com.lagradost.cloudstream3.utils.SubtitleHelper.fromLanguageToTagIETF
import com.lagradost.cloudstream3.utils.SubtitleHelper.fromTagToEnglishLanguageName
import com.lagradost.cloudstream3.utils.SubtitleHelper.fromTagToLanguageName
import com.lagradost.cloudstream3.utils.SubtitleHelper.languages
Expand Down Expand Up @@ -513,7 +509,7 @@ class GeneratorPlayer : FullScreenPlayer() {
}
// setEpisodes(viewModel.getAllMeta() ?: emptyList())
isActive = true
setPlayerDimen(null)
updatePlayerInfo(reset = true)
setTitle()
if (!sameEpisode)
hasRequestedStamps = false
Expand Down Expand Up @@ -1804,55 +1800,36 @@ class GeneratorPlayer : FullScreenPlayer() {
playerBinding?.offlinePin?.isVisible = lastUsedGenerator is DownloadFileGenerator
}

@SuppressLint("SetTextI18n")
fun setPlayerDimen(widthHeight: Pair<Int, Int>?) {
val extra = widthHeight?.let { (w, h) -> "${w}x${h}" } ?: ""
val source = currentSelectedLink?.first?.name ?: currentSelectedLink?.second?.name ?: "NULL"
val headerName = getHeaderName().orEmpty()


val title = when (titleRez) {
0 -> ""
1 -> extra
2 -> source
3 -> "$source${
if (source.isBlank()) {
""
} else {
" - "
}
}$extra"

4 -> headerName
5 -> "$headerName${
if (headerName.isBlank()) {
""
} else {
" - "
}
}$extra"

else -> ""
}
playerBinding?.playerVideoTitleRez?.apply {
text = title
isVisible = title.isNotBlank()
/**
* Show the current playback information (e.g. resolution, codec) in the player info text view.
*
* If [reset] is set to `true`, the text view will be cleared instead.
*/
private fun updatePlayerInfo(reset: Boolean = false) {
if (reset) {
playerBinding?.playerVideoInfo?.text = ""
playerBinding?.playerVideoInfo?.isGone = true
return
}
}
private fun updatePlayerInfo() {

val tracks = player.getVideoTracks()

val videoTrack = tracks.currentVideoTrack
val audioTrack = tracks.currentAudioTrack

val resolution = videoTrack?.let { "${it.width}x${it.height}" }
val source = currentSelectedLink?.first?.name ?: currentSelectedLink?.second?.name
val headerName = getHeaderName().orEmpty()

val videoCodec = videoTrack?.sampleMimeType?.substringAfterLast('/')?.uppercase()
val audioCodec = audioTrack?.sampleMimeType?.substringAfterLast('/')?.uppercase()
val language = listOfNotNull(
audioTrack?.label,
fromTagToLanguageName(audioTrack?.language)?.let { "[$it]" }
).joinToString(" ")

val stats = arrayOf(videoCodec, audioCodec, language).filter { !it.isNullOrBlank() }.joinToString(" • ")
val stats = arrayOf(source, headerName, resolution, videoCodec, audioCodec, language)
.filter { !it.isNullOrBlank() }.joinToString(" • ")

playerBinding?.playerVideoInfo?.apply {
text = stats
Expand All @@ -1862,7 +1839,7 @@ class GeneratorPlayer : FullScreenPlayer() {

override fun playerDimensionsLoaded(width: Int, height: Int) {
super.playerDimensionsLoaded(width, height)
setPlayerDimen(width to height)
updatePlayerInfo()
}

private fun unwrapBundle(savedInstanceState: Bundle?) {
Expand Down
18 changes: 4 additions & 14 deletions app/src/main/res/layout/player_custom_layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -146,25 +146,15 @@
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent">

<TextView
android:id="@+id/player_video_title_rez"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="2.5dp"
android:gravity="center"
android:textColor="@color/white"
tools:text="1920x1080" />


<TextView
android:id="@+id/player_video_info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="6dp"
android:gravity="center"
android:layout_marginBottom="2.5dp"
android:textColor="@color/white"
android:visibility="gone"
tools:text="HEVC" />
android:textColor="@color/grayTextColor"
android:textSize="12sp"
tools:text="1920x1080 • HDR10 • HEVC" />

<LinearLayout
android:id="@+id/player_video_title_holder"
Expand Down
21 changes: 4 additions & 17 deletions app/src/main/res/layout/player_custom_layout_tv.xml
Original file line number Diff line number Diff line change
Expand Up @@ -307,30 +307,17 @@
android:layout_gravity="start"/>
</LinearLayout>

<TextView
android:id="@+id/player_video_title_rez"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:gravity="end"
android:maxWidth="600dp"
android:textAlignment="viewEnd"
android:textColor="@color/white"
android:textSize="16sp"
tools:text="1920x1080" />

<TextView
android:id="@+id/player_video_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:layout_marginTop="6dp"
android:layout_marginBottom="2.5dp"
android:textColor="@color/white"
android:textSize="16sp"
android:visibility="gone"
android:textColor="@color/grayTextColor"
android:textSize="12sp"
android:layout_gravity="end"
tools:text="HDR10 • HEVC" />

tools:text="1920x1080 • HDR10 • HEVC" />

<FrameLayout
android:id="@+id/player_episode_filler_holder"
Expand Down
32 changes: 13 additions & 19 deletions app/src/main/res/layout/trailer_custom_layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
android:id="@+id/player_top_holder"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone">
>

<LinearLayout
android:layout_width="match_parent"
Expand All @@ -96,6 +96,17 @@
android:layout_marginEnd="32dp"
android:orientation="vertical">

<TextView
android:id="@+id/player_video_info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_marginBottom="6dp"
android:textColor="@color/grayTextColor"
android:textSize="12sp"
android:ellipsize="end"
tools:text="1920x1080 • HDR10 • HEVC" />

<LinearLayout
android:id="@+id/player_video_title_holder"
android:layout_width="match_parent"
Expand All @@ -111,16 +122,7 @@
android:textSize="16sp"
android:textStyle="bold"
tools:text="Hello world" />
<TextView
android:id="@+id/player_video_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:layout_marginBottom="2.5dp"
android:textColor="@color/white"
android:textSize="10sp"
android:visibility="gone"
tools:text="HDR10 • HEVC" />

<ImageView
android:id="@+id/offline_pin"
android:layout_width="16dp"
Expand All @@ -131,14 +133,6 @@
tools:visibility="visible"
android:layout_gravity="center"/>
</LinearLayout>
<TextView
android:id="@+id/player_video_title_rez"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="end"
android:textColor="@color/white"
android:textSize="16sp"
tools:text="1920x1080" />

<FrameLayout
android:id="@+id/player_episode_filler_holder"
Expand Down