mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2025-07-08 13:04:41 +02:00
fix min pause time to 3000 ms
This commit is contained in:
parent
504393ff2b
commit
2b14460bf1
2 changed files with 14 additions and 14 deletions
|
@ -492,7 +492,7 @@ class PlayerNotificationService : MediaBrowserServiceCompat() {
|
||||||
if (lastPauseTime <= 0) return 0
|
if (lastPauseTime <= 0) return 0
|
||||||
var time: Long = System.currentTimeMillis() - lastPauseTime
|
var time: Long = System.currentTimeMillis() - lastPauseTime
|
||||||
var seekback: Long = 0
|
var seekback: Long = 0
|
||||||
if (time < 3) seekback = 0
|
if (time < 3000) seekback = 0
|
||||||
else if (time < 60000) seekback = time / 6
|
else if (time < 60000) seekback = time / 6
|
||||||
else if (time < 300000) seekback = 15000
|
else if (time < 300000) seekback = 15000
|
||||||
else if (time < 1800000) seekback = 20000
|
else if (time < 1800000) seekback = 20000
|
||||||
|
|
|
@ -203,7 +203,7 @@ export default {
|
||||||
calcSeekBackTime(lastUpdate) {
|
calcSeekBackTime(lastUpdate) {
|
||||||
var time = Date.now() - lastUpdate
|
var time = Date.now() - lastUpdate
|
||||||
var seekback = 0
|
var seekback = 0
|
||||||
if (time < 3) seekback = 0
|
if (time < 3000) seekback = 0
|
||||||
else if (time < 60000) seekback = time / 6
|
else if (time < 60000) seekback = time / 6
|
||||||
else if (time < 300000) seekback = 15000
|
else if (time < 300000) seekback = 15000
|
||||||
else if (time < 1800000) seekback = 20000
|
else if (time < 1800000) seekback = 20000
|
||||||
|
@ -220,9 +220,9 @@ export default {
|
||||||
//console.log(JSON.stringify(stream))
|
//console.log(JSON.stringify(stream))
|
||||||
var data = await MyNativeAudio.getStreamSyncData()
|
var data = await MyNativeAudio.getStreamSyncData()
|
||||||
console.log('getStreamSyncData', JSON.stringify(data))
|
console.log('getStreamSyncData', JSON.stringify(data))
|
||||||
console.log('lastUpdate', !!stream.lastUpdate ? stream.lastUpdate : 0)
|
console.log('lastUpdate', stream.lastUpdate || 0)
|
||||||
//Same audiobook
|
//Same audiobook
|
||||||
if (data.id == stream.id && (data.isPlaying || (data.lastPauseTime >= (!!stream.lastUpdate ? stream.lastUpdate : 0)))) {
|
if (data.id == stream.id && (data.isPlaying || data.lastPauseTime >= (stream.lastUpdate || 0))) {
|
||||||
console.log('Same audiobook')
|
console.log('Same audiobook')
|
||||||
this.isPaused = !data.isPlaying
|
this.isPaused = !data.isPlaying
|
||||||
this.currentTime = Number((data.currentTime / 1000).toFixed(2))
|
this.currentTime = Number((data.currentTime / 1000).toFixed(2))
|
||||||
|
@ -230,8 +230,7 @@ export default {
|
||||||
if (data.isPlaying) {
|
if (data.isPlaying) {
|
||||||
console.log('playing - continue')
|
console.log('playing - continue')
|
||||||
if (fromAppDestroy) this.startPlayInterval()
|
if (fromAppDestroy) this.startPlayInterval()
|
||||||
}
|
} else console.log('paused and newer')
|
||||||
else console.log('paused and newer')
|
|
||||||
if (!fromAppDestroy) return
|
if (!fromAppDestroy) return
|
||||||
init = false
|
init = false
|
||||||
this.initObject.startTime = String(Math.floor(this.currentTime * 1000))
|
this.initObject.startTime = String(Math.floor(this.currentTime * 1000))
|
||||||
|
@ -250,7 +249,8 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.currentPlaybackRate = this.initObject.playbackSpeed
|
this.currentPlaybackRate = this.initObject.playbackSpeed
|
||||||
if (init) MyNativeAudio.initPlayer(this.initObject).then((res) => {
|
if (init)
|
||||||
|
MyNativeAudio.initPlayer(this.initObject).then((res) => {
|
||||||
if (res && res.success) {
|
if (res && res.success) {
|
||||||
console.log('Success init audio player')
|
console.log('Success init audio player')
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue