mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-01-18 03:48:55 +01:00
transcoding maxSeekBackTime more; json add lastUpdate
This commit is contained in:
parent
c5eafdfa8a
commit
8ffb4f88c9
@ -16,6 +16,7 @@ class Stream extends EventEmitter {
|
|||||||
this.audiobook = audiobook
|
this.audiobook = audiobook
|
||||||
|
|
||||||
this.segmentLength = 6
|
this.segmentLength = 6
|
||||||
|
this.maxSeekBackTime = 30
|
||||||
this.streamPath = Path.join(streamPath, this.id)
|
this.streamPath = Path.join(streamPath, this.id)
|
||||||
this.concatFilesPath = Path.join(this.streamPath, 'files.txt')
|
this.concatFilesPath = Path.join(this.streamPath, 'files.txt')
|
||||||
this.playlistPath = Path.join(this.streamPath, 'output.m3u8')
|
this.playlistPath = Path.join(this.streamPath, 'output.m3u8')
|
||||||
@ -67,7 +68,7 @@ class Stream extends EventEmitter {
|
|||||||
|
|
||||||
get segmentStartNumber() {
|
get segmentStartNumber() {
|
||||||
if (!this.startTime) return 0
|
if (!this.startTime) return 0
|
||||||
return Math.floor(this.startTime / this.segmentLength)
|
return Math.floor((this.startTime >= this.maxSeekBackTime ? (this.startTime - this.maxSeekBackTime) : 0) / this.segmentLength)
|
||||||
}
|
}
|
||||||
|
|
||||||
get numSegments() {
|
get numSegments() {
|
||||||
@ -104,7 +105,8 @@ class Stream extends EventEmitter {
|
|||||||
clientCurrentTime: this.clientCurrentTime,
|
clientCurrentTime: this.clientCurrentTime,
|
||||||
startTime: this.startTime,
|
startTime: this.startTime,
|
||||||
segmentStartNumber: this.segmentStartNumber,
|
segmentStartNumber: this.segmentStartNumber,
|
||||||
isTranscodeComplete: this.isTranscodeComplete
|
isTranscodeComplete: this.isTranscodeComplete,
|
||||||
|
lastUpdate: this.client.user.audiobooks[this.audiobook.id].lastUpdate
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -239,7 +241,8 @@ class Stream extends EventEmitter {
|
|||||||
|
|
||||||
this.ffmpeg = Ffmpeg()
|
this.ffmpeg = Ffmpeg()
|
||||||
|
|
||||||
var trackStartTime = await writeConcatFile(this.tracks, this.concatFilesPath, this.startTime)
|
var timeStart = this.startTime >= this.maxSeekBackTime ? (this.startTime - this.maxSeekBackTime) : 0
|
||||||
|
var trackStartTime = await writeConcatFile(this.tracks, this.concatFilesPath, timeStart)
|
||||||
|
|
||||||
this.ffmpeg.addInput(this.concatFilesPath)
|
this.ffmpeg.addInput(this.concatFilesPath)
|
||||||
// seek_timestamp : https://ffmpeg.org/ffmpeg.html
|
// seek_timestamp : https://ffmpeg.org/ffmpeg.html
|
||||||
@ -250,8 +253,8 @@ class Stream extends EventEmitter {
|
|||||||
this.ffmpeg.inputOption('-safe 0')
|
this.ffmpeg.inputOption('-safe 0')
|
||||||
// this.ffmpeg.inputOption('-segment_time_metadata 1')
|
// this.ffmpeg.inputOption('-segment_time_metadata 1')
|
||||||
|
|
||||||
if (this.startTime > 0) {
|
if (timeStart > 0) {
|
||||||
const shiftedStartTime = this.startTime - trackStartTime
|
const shiftedStartTime = timeStart - trackStartTime
|
||||||
// Issues using exact fractional seconds i.e. 29.49814 - changing to 29.5s
|
// Issues using exact fractional seconds i.e. 29.49814 - changing to 29.5s
|
||||||
var startTimeS = Math.round(shiftedStartTime * 10) / 10 + 's'
|
var startTimeS = Math.round(shiftedStartTime * 10) / 10 + 's'
|
||||||
Logger.info(`[STREAM] Starting Stream at startTime ${secondsToTimestamp(this.startTime)} and Segment #${this.segmentStartNumber}`)
|
Logger.info(`[STREAM] Starting Stream at startTime ${secondsToTimestamp(this.startTime)} and Segment #${this.segmentStartNumber}`)
|
||||||
|
Loading…
Reference in New Issue
Block a user