mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2026-07-29 07:58:43 +02:00
fix progress bar data loss after restore from app destroy when playing is on
This commit is contained in:
@@ -96,11 +96,14 @@ class MyNativeAudio : Plugin() {
|
||||
//if (!isPlaying) currentTime -= playerNotificationService.calcPauseSeekBackTime()
|
||||
var id = playerNotificationService.getCurrentAudiobookId()
|
||||
Log.d(tag, "Get Current id $id")
|
||||
var duration = playerNotificationService.getDuration()
|
||||
Log.d(tag, "Get duration $duration")
|
||||
val ret = JSObject()
|
||||
ret.put("lastPauseTime", lastPauseTime)
|
||||
ret.put("currentTime", currentTime)
|
||||
ret.put("isPlaying", isPlaying)
|
||||
ret.put("id", id)
|
||||
ret.put("duration", duration)
|
||||
call.resolve(ret)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -493,6 +493,10 @@ class PlayerNotificationService : MediaBrowserServiceCompat() {
|
||||
return lastPauseTime
|
||||
}
|
||||
|
||||
fun getDuration() : Long {
|
||||
return mPlayer.duration
|
||||
}
|
||||
|
||||
fun calcPauseSeekBackTime() : Long {
|
||||
if (lastPauseTime <= 0) return 0
|
||||
var time: Long = System.currentTimeMillis() - lastPauseTime
|
||||
|
||||
Reference in New Issue
Block a user