mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-28 16:00:31 +05:30
commit
c2f95a5548
@ -131,7 +131,7 @@ class BackgroundMode : Service() {
|
|||||||
streamItem.url?.toID()?.let { playNextVideo(it) }
|
streamItem.url?.toID()?.let { playNextVideo(it) }
|
||||||
}
|
}
|
||||||
|
|
||||||
updateWatchPosition()
|
if (PlayerHelper.watchPositionsEnabled) updateWatchPosition()
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
onDestroy()
|
onDestroy()
|
||||||
}
|
}
|
||||||
|
@ -501,11 +501,12 @@ class PlayerFragment : BaseFragment(), OnlinePlayerOptions {
|
|||||||
override fun onDestroy() {
|
override fun onDestroy() {
|
||||||
super.onDestroy()
|
super.onDestroy()
|
||||||
try {
|
try {
|
||||||
// clear the playing queue
|
|
||||||
PlayingQueue.resetToDefaults()
|
|
||||||
|
|
||||||
saveWatchPosition()
|
saveWatchPosition()
|
||||||
|
|
||||||
|
// clear the playing queue and release the player
|
||||||
|
PlayingQueue.resetToDefaults()
|
||||||
nowPlayingNotification.destroySelfAndPlayer()
|
nowPlayingNotification.destroySelfAndPlayer()
|
||||||
|
|
||||||
activity?.requestedOrientation =
|
activity?.requestedOrientation =
|
||||||
if ((activity as MainActivity).autoRotationEnabled) {
|
if ((activity as MainActivity).autoRotationEnabled) {
|
||||||
ActivityInfo.SCREEN_ORIENTATION_USER
|
ActivityInfo.SCREEN_ORIENTATION_USER
|
||||||
@ -520,16 +521,16 @@ class PlayerFragment : BaseFragment(), OnlinePlayerOptions {
|
|||||||
// save the watch position if video isn't finished and option enabled
|
// save the watch position if video isn't finished and option enabled
|
||||||
private fun saveWatchPosition() {
|
private fun saveWatchPosition() {
|
||||||
if (!PlayerHelper.watchPositionsEnabled) return
|
if (!PlayerHelper.watchPositionsEnabled) return
|
||||||
if (exoPlayer.currentPosition != exoPlayer.duration) {
|
Log.e(
|
||||||
val watchPosition = WatchPosition(videoId!!, exoPlayer.currentPosition)
|
"watchpositions",
|
||||||
query {
|
PreferenceHelper.getBoolean(
|
||||||
Database.watchPositionDao().insertAll(watchPosition)
|
PreferenceKeys.WATCH_POSITION_TOGGLE,
|
||||||
}
|
true
|
||||||
} else if (PlayerHelper.watchPositionsEnabled) {
|
).toString()
|
||||||
// delete watch position if video has ended
|
)
|
||||||
query {
|
val watchPosition = WatchPosition(videoId!!, exoPlayer.currentPosition)
|
||||||
Database.watchPositionDao().deleteById(videoId!!)
|
query {
|
||||||
}
|
Database.watchPositionDao().insertAll(watchPosition)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -256,12 +256,6 @@ object PlayerHelper {
|
|||||||
false
|
false
|
||||||
)
|
)
|
||||||
|
|
||||||
val progressiveLoadingIntervalSize: String
|
|
||||||
get() = PreferenceHelper.getString(
|
|
||||||
PreferenceKeys.PROGRESSIVE_LOADING_INTERVAL_SIZE,
|
|
||||||
"64"
|
|
||||||
)
|
|
||||||
|
|
||||||
val autoPlayEnabled: Boolean
|
val autoPlayEnabled: Boolean
|
||||||
get() = PreferenceHelper.getBoolean(
|
get() = PreferenceHelper.getBoolean(
|
||||||
PreferenceKeys.AUTO_PLAY,
|
PreferenceKeys.AUTO_PLAY,
|
||||||
|
@ -76,15 +76,6 @@
|
|||||||
android:title="@string/hls_instead_of_dash"
|
android:title="@string/hls_instead_of_dash"
|
||||||
app:key="use_hls" />
|
app:key="use_hls" />
|
||||||
|
|
||||||
<ListPreference
|
|
||||||
android:icon="@drawable/ic_loading"
|
|
||||||
app:defaultValue="64"
|
|
||||||
app:entries="@array/loadingInterval"
|
|
||||||
app:entryValues="@array/loadingIntervalValues"
|
|
||||||
app:key="progressive_loading_interval"
|
|
||||||
app:summary="@string/progressive_load_interval_summary"
|
|
||||||
app:title="@string/progressive_load_interval" />
|
|
||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
<PreferenceCategory app:title="@string/background_mode">
|
<PreferenceCategory app:title="@string/background_mode">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user