mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-07-16 14:21:41 +00:00
Don't sync progress for finished content
-> Still has the potential issue of starting a listening session
This commit is contained in:
parent
3c406c12b4
commit
1522783034
6 changed files with 21 additions and 9 deletions
|
|
@ -27,6 +27,7 @@ export default class PlayerHandler {
|
|||
this.listeningTimeSinceSync = 0
|
||||
|
||||
this.playInterval = null
|
||||
this.syncProgress = true
|
||||
}
|
||||
|
||||
get isCasting() {
|
||||
|
|
@ -218,6 +219,7 @@ export default class PlayerHandler {
|
|||
prepareSession(session) {
|
||||
this.failedProgressSyncs = 0
|
||||
this.startTime = this.startTimeOverride !== undefined ? this.startTimeOverride : session.currentTime
|
||||
this.syncProgress = !session.isFinished
|
||||
this.currentSessionId = session.id
|
||||
this.displayTitle = session.displayTitle
|
||||
this.displayAuthor = session.displayAuthor
|
||||
|
|
@ -300,7 +302,7 @@ export default class PlayerHandler {
|
|||
if (this.player) {
|
||||
const listeningTimeToAdd = Math.max(0, Math.floor(this.listeningTimeSinceSync))
|
||||
// When opening player and quickly closing dont save progress
|
||||
if (listeningTimeToAdd > 20 || this.lastSyncTime > 0) {
|
||||
if (this.syncProgress && (listeningTimeToAdd > 20 || this.lastSyncTime > 0)) {
|
||||
syncData = {
|
||||
timeListened: listeningTimeToAdd,
|
||||
duration: this.getDuration(),
|
||||
|
|
@ -316,7 +318,7 @@ export default class PlayerHandler {
|
|||
}
|
||||
|
||||
sendProgressSync(currentTime) {
|
||||
if (this.isMusic) return
|
||||
if (this.isMusic || !this.syncProgress) return
|
||||
|
||||
const diffSinceLastSync = Math.abs(this.lastSyncTime - currentTime)
|
||||
if (diffSinceLastSync < 1) return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue