mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 14:20:30 +05:30
Fix that queue controls are visible while player closed
This commit is contained in:
parent
9ff86d3155
commit
38be961011
@ -364,7 +364,8 @@ class BackgroundMode : LifecycleService() {
|
||||
* destroy the [BackgroundMode] foreground service
|
||||
*/
|
||||
override fun onDestroy() {
|
||||
// clear the playing queue
|
||||
// clear and reset the playing queue
|
||||
PlayingQueue.clear()
|
||||
PlayingQueue.resetToDefaults()
|
||||
|
||||
if (this::nowPlayingNotification.isInitialized) nowPlayingNotification.destroySelfAndPlayer()
|
||||
|
@ -584,6 +584,8 @@ class PlayerFragment : Fragment(R.layout.fragment_player), OnlinePlayerOptions {
|
||||
|
||||
saveWatchPosition()
|
||||
|
||||
PlayingQueue.clear()
|
||||
|
||||
// release the player
|
||||
nowPlayingNotification.destroySelfAndPlayer()
|
||||
|
||||
@ -644,18 +646,18 @@ class PlayerFragment : Fragment(R.layout.fragment_player), OnlinePlayerOptions {
|
||||
// reset the comments to become reloaded later
|
||||
commentsViewModel.reset()
|
||||
|
||||
lifecycleScope.launchWhenCreated {
|
||||
lifecycleScope.launch(Dispatchers.IO) {
|
||||
streams = try {
|
||||
RetrofitInstance.api.getStreams(videoId!!)
|
||||
} catch (e: IOException) {
|
||||
Toast.makeText(context, R.string.unknown_error, Toast.LENGTH_LONG).show()
|
||||
return@launchWhenCreated
|
||||
return@launch
|
||||
} catch (e: HttpException) {
|
||||
val errorMessage = e.response()?.errorBody()?.string()?.runCatching {
|
||||
JsonHelper.json.decodeFromString<Message>(this).message
|
||||
}?.getOrNull() ?: context?.getString(R.string.server_error) ?: ""
|
||||
Toast.makeText(context, errorMessage, Toast.LENGTH_LONG).show()
|
||||
return@launchWhenCreated
|
||||
return@launch
|
||||
}
|
||||
|
||||
if (PlayingQueue.isEmpty()) {
|
||||
|
Loading…
Reference in New Issue
Block a user