mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-28 07:50:31 +05:30
rename hls to auto
This commit is contained in:
parent
5c3fda3d1f
commit
b7d9d510f6
@ -21,6 +21,7 @@ import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Toast
|
||||
import androidx.constraintlayout.motion.widget.MotionLayout
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.core.net.toUri
|
||||
import androidx.core.os.bundleOf
|
||||
import androidx.core.view.isVisible
|
||||
@ -75,6 +76,7 @@ import com.google.android.exoplayer2.upstream.DataSource
|
||||
import com.google.android.exoplayer2.upstream.DefaultDataSource
|
||||
import com.google.android.exoplayer2.upstream.DefaultHttpDataSource
|
||||
import com.google.android.exoplayer2.util.RepeatModeUtil
|
||||
import com.google.android.exoplayer2.video.VideoSize
|
||||
import com.google.android.material.button.MaterialButton
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import com.squareup.picasso.Picasso
|
||||
@ -169,6 +171,7 @@ class PlayerFragment : Fragment() {
|
||||
mainActivity.binding.container.visibility = View.VISIBLE
|
||||
|
||||
exoPlayerView = binding.player
|
||||
binding.mainContainer.visibility = View.GONE
|
||||
|
||||
binding.playerMotionLayout.addTransitionListener(object : MotionLayout.TransitionListener {
|
||||
override fun onTransitionStarted(
|
||||
@ -671,6 +674,24 @@ class PlayerFragment : Fragment() {
|
||||
}
|
||||
}
|
||||
|
||||
override fun onVideoSizeChanged(
|
||||
videoSize: VideoSize
|
||||
) {
|
||||
// Set new width/height of view
|
||||
// height or width must be cast to float as int/int will give 0
|
||||
|
||||
val currentWidth = binding.mainContainer.height
|
||||
// Redraw myView
|
||||
(binding.mainContainer.layoutParams as ConstraintLayout.LayoutParams).apply {
|
||||
matchConstraintPercentHeight = (
|
||||
videoSize.height / videoSize.width * currentWidth
|
||||
).toFloat()
|
||||
}
|
||||
binding.mainContainer.requestLayout()
|
||||
|
||||
// FIXME and make me work :/
|
||||
}
|
||||
|
||||
@Deprecated(message = "Deprecated", level = DeprecationLevel.HIDDEN)
|
||||
override fun onPlayerStateChanged(
|
||||
playWhenReady: Boolean,
|
||||
@ -835,7 +856,7 @@ class PlayerFragment : Fragment() {
|
||||
|
||||
// append hls to list if available
|
||||
if (response.hls != null) {
|
||||
videosNameArray += "HLS"
|
||||
videosNameArray += getString(R.string.hls)
|
||||
videosUrlArray += response.hls.toUri()
|
||||
}
|
||||
|
||||
@ -916,7 +937,7 @@ class PlayerFragment : Fragment() {
|
||||
) { _, which ->
|
||||
whichQuality = which
|
||||
if (
|
||||
videosNameArray[which] == "HLS" ||
|
||||
videosNameArray[which] == getString(R.string.hls) ||
|
||||
videosNameArray[which] == "LBRY HLS"
|
||||
) {
|
||||
// no need to merge sources if using hls
|
||||
|
@ -110,7 +110,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:padding="@dimen/exo_icon_padding"
|
||||
android:text="HLS"
|
||||
android:text="@string/hls"
|
||||
android:textColor="#FFFFFF" />
|
||||
|
||||
<ImageView
|
||||
|
@ -347,15 +347,14 @@
|
||||
android:layout_height="0dp"
|
||||
android:background="?attr/colorSurface"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHeight_percent="0.35"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintHeight_percent="0.3"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<com.github.libretube.views.CustomExoPlayerView
|
||||
android:id="@+id/player"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#000000"
|
||||
android:scaleType="centerCrop"
|
||||
app:layout_constraintBottom_toBottomOf="@id/main_container"
|
||||
|
@ -572,7 +572,7 @@
|
||||
</string-array>
|
||||
|
||||
<string-array name="defres">
|
||||
<item>HLS</item>
|
||||
<item>@string/hls</item>
|
||||
<item>1080p</item>
|
||||
<item>720p</item>
|
||||
<item>480p</item>
|
||||
|
@ -213,4 +213,5 @@
|
||||
<string name="auth_instance">Authentication instance</string>
|
||||
<string name="auth_instance_summary">Use a different instance for authenticated calls.</string>
|
||||
<string name="auth_instances">Choose an auth instance</string>
|
||||
<string name="hls">Auto</string>
|
||||
</resources>
|
Loading…
x
Reference in New Issue
Block a user