mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-13 22:00:30 +05:30
Merge branch 'master' into master
This commit is contained in:
commit
c1a4cbec6a
@ -53,6 +53,7 @@ import com.github.libretube.obj.Segment
|
|||||||
import com.github.libretube.obj.Segments
|
import com.github.libretube.obj.Segments
|
||||||
import com.github.libretube.obj.Streams
|
import com.github.libretube.obj.Streams
|
||||||
import com.github.libretube.obj.Subscribe
|
import com.github.libretube.obj.Subscribe
|
||||||
|
import com.github.libretube.obj.StreamItem
|
||||||
import com.github.libretube.preferences.SponsorBlockSettings
|
import com.github.libretube.preferences.SponsorBlockSettings
|
||||||
import com.github.libretube.util.CronetHelper
|
import com.github.libretube.util.CronetHelper
|
||||||
import com.github.libretube.util.DescriptionAdapter
|
import com.github.libretube.util.DescriptionAdapter
|
||||||
@ -101,6 +102,8 @@ class PlayerFragment : Fragment() {
|
|||||||
private var eId: Int = 0
|
private var eId: Int = 0
|
||||||
private var paused = false
|
private var paused = false
|
||||||
private var whichQuality = 0
|
private var whichQuality = 0
|
||||||
|
private var transitioning = false
|
||||||
|
private var autoplay = false
|
||||||
private var isZoomed: Boolean = false
|
private var isZoomed: Boolean = false
|
||||||
|
|
||||||
private var isSubscribed: Boolean = false
|
private var isSubscribed: Boolean = false
|
||||||
@ -115,6 +118,7 @@ class PlayerFragment : Fragment() {
|
|||||||
private lateinit var motionLayout: MotionLayout
|
private lateinit var motionLayout: MotionLayout
|
||||||
private lateinit var exoPlayer: ExoPlayer
|
private lateinit var exoPlayer: ExoPlayer
|
||||||
private lateinit var segmentData: Segments
|
private lateinit var segmentData: Segments
|
||||||
|
private var relatedStreams: List<StreamItem>? = arrayListOf()
|
||||||
private var relatedStreamsEnabled = true
|
private var relatedStreamsEnabled = true
|
||||||
|
|
||||||
private lateinit var relDownloadVideo: LinearLayout
|
private lateinit var relDownloadVideo: LinearLayout
|
||||||
@ -386,10 +390,13 @@ class PlayerFragment : Fragment() {
|
|||||||
uploader = response.uploader!!
|
uploader = response.uploader!!
|
||||||
thumbnailUrl = response.thumbnailUrl!!
|
thumbnailUrl = response.thumbnailUrl!!
|
||||||
|
|
||||||
// check whether related streams are enabled
|
// check whether related streams and autoplay are enabled
|
||||||
val sharedPreferences = PreferenceManager
|
val sharedPreferences = PreferenceManager
|
||||||
.getDefaultSharedPreferences(requireContext())
|
.getDefaultSharedPreferences(requireContext())
|
||||||
|
autoplay = sharedPreferences.getBoolean("autoplay", false)
|
||||||
relatedStreamsEnabled = sharedPreferences.getBoolean("related_streams_toggle", true)
|
relatedStreamsEnabled = sharedPreferences.getBoolean("related_streams_toggle", true)
|
||||||
|
// save related streams for autoplay
|
||||||
|
relatedStreams = response.relatedStreams
|
||||||
runOnUiThread {
|
runOnUiThread {
|
||||||
createExoPlayer(view)
|
createExoPlayer(view)
|
||||||
prepareExoPlayerView()
|
prepareExoPlayerView()
|
||||||
@ -515,8 +522,22 @@ class PlayerFragment : Fragment() {
|
|||||||
!playWhenReady
|
!playWhenReady
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// check if video has ended, next video is available and autoplay is enabled.
|
||||||
|
if (
|
||||||
|
playbackState == Player.STATE_ENDED &&
|
||||||
|
relatedStreams != null &&
|
||||||
|
relatedStreams!!.isNotEmpty() &&
|
||||||
|
!transitioning &&
|
||||||
|
autoplay
|
||||||
|
) {
|
||||||
|
transitioning = true
|
||||||
|
videoId = relatedStreams!![0].url!!.replace("/watch?v=", "")
|
||||||
|
fetchJsonAndInitPlayer(view)
|
||||||
|
}
|
||||||
|
|
||||||
if (playWhenReady && playbackState == Player.STATE_READY) {
|
if (playWhenReady && playbackState == Player.STATE_READY) {
|
||||||
// media actually playing
|
// media actually playing
|
||||||
|
transitioning = false
|
||||||
view.findViewById<ImageView>(R.id.play_imageView)
|
view.findViewById<ImageView>(R.id.play_imageView)
|
||||||
.setImageResource(R.drawable.ic_pause)
|
.setImageResource(R.drawable.ic_pause)
|
||||||
} else if (playWhenReady) {
|
} else if (playWhenReady) {
|
||||||
|
@ -189,4 +189,5 @@
|
|||||||
<string name="audio">Audio</string>
|
<string name="audio">Audio</string>
|
||||||
<string name="video">Video</string>
|
<string name="video">Video</string>
|
||||||
<string name="downloading">Downloading</string>
|
<string name="downloading">Downloading</string>
|
||||||
|
<string name="player_autoplay">Autoplay</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -40,6 +40,13 @@
|
|||||||
app:summary="@string/buffering_goal_summary"
|
app:summary="@string/buffering_goal_summary"
|
||||||
app:title="@string/buffering_goal" />
|
app:title="@string/buffering_goal" />
|
||||||
|
|
||||||
|
<SwitchPreferenceCompat
|
||||||
|
android:icon="@drawable/ic_play"
|
||||||
|
app:key="autoplay"
|
||||||
|
app:title="@string/player_autoplay"
|
||||||
|
android:summaryOff="@string/disabled"
|
||||||
|
android:summaryOn="@string/enabled" />
|
||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
<PreferenceCategory app:title="@string/downloads">
|
<PreferenceCategory app:title="@string/downloads">
|
||||||
|
9
fastlane/metadata/android/en-US/changelogs/12.txt
Normal file
9
fastlane/metadata/android/en-US/changelogs/12.txt
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
Subscribed Channels Rework
|
||||||
|
Update Checker
|
||||||
|
About Section in Settings
|
||||||
|
Live videos fix and indication
|
||||||
|
Comment replies
|
||||||
|
Search suggestions rewrite
|
||||||
|
Custom instance option
|
||||||
|
Video chapters support
|
||||||
|
Player notification thumbnail and description
|
Loading…
Reference in New Issue
Block a user