mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2025-08-04 10:04:39 +02:00
Fix:Reset volume when playing from notification after sleep timer decreases volume #182
This commit is contained in:
parent
573768e2b2
commit
0e0b356f6b
2 changed files with 4 additions and 4 deletions
|
@ -15,7 +15,7 @@ class PlayerListener(var playerNotificationService:PlayerNotificationService) :
|
|||
private var onSeekBack: Boolean = false
|
||||
|
||||
override fun onPlayerError(error: PlaybackException) {
|
||||
var errorMessage = error.message ?: "Unknown Error"
|
||||
val errorMessage = error.message ?: "Unknown Error"
|
||||
Log.e(tag, "onPlayerError $errorMessage")
|
||||
playerNotificationService.handlePlayerPlaybackError(errorMessage) // If was direct playing session, fallback to transcode
|
||||
}
|
||||
|
@ -90,6 +90,7 @@ class PlayerListener(var playerNotificationService:PlayerNotificationService) :
|
|||
// Start/stop progress sync interval
|
||||
Log.d(tag, "Playing ${playerNotificationService.getCurrentBookTitle()}")
|
||||
if (player.isPlaying) {
|
||||
player.volume = 1F // Volume on sleep timer might have decreased this
|
||||
playerNotificationService.mediaProgressSyncer.start()
|
||||
} else {
|
||||
playerNotificationService.mediaProgressSyncer.stop()
|
||||
|
|
|
@ -9,7 +9,6 @@ import android.hardware.SensorManager
|
|||
import android.os.*
|
||||
import android.support.v4.media.MediaBrowserCompat
|
||||
import android.support.v4.media.MediaDescriptionCompat
|
||||
import android.support.v4.media.MediaMetadataCompat
|
||||
import android.support.v4.media.session.MediaControllerCompat
|
||||
import android.support.v4.media.session.MediaSessionCompat
|
||||
import android.support.v4.media.session.PlaybackStateCompat
|
||||
|
@ -357,7 +356,9 @@ class PlayerNotificationService : MediaBrowserServiceCompat() {
|
|||
Log.d(tag, "Prepare complete for session ${currentPlaybackSession?.displayTitle} | ${currentPlayer.mediaItemCount}")
|
||||
currentPlayer.playWhenReady = playWhenReady
|
||||
currentPlayer.setPlaybackSpeed(playbackRateToUse)
|
||||
|
||||
currentPlayer.prepare()
|
||||
|
||||
} else if (castPlayer != null) {
|
||||
val currentTrackIndex = playbackSession.getCurrentTrackIndex()
|
||||
val currentTrackTime = playbackSession.getCurrentTrackTimeMs()
|
||||
|
@ -521,12 +522,10 @@ class PlayerNotificationService : MediaBrowserServiceCompat() {
|
|||
|
||||
fun seekForward(amount: Long) {
|
||||
seekPlayer(getCurrentTime() + amount)
|
||||
// currentPlayer.seekTo(currentPlayer.currentPosition + amount)
|
||||
}
|
||||
|
||||
fun seekBackward(amount: Long) {
|
||||
seekPlayer(getCurrentTime() - amount)
|
||||
// currentPlayer.seekTo(currentPlayer.currentPosition - amount)
|
||||
}
|
||||
|
||||
fun setPlaybackSpeed(speed: Float) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue