mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-01-03 00:06:46 +01:00
Remove open playback sessions for user when starting a new playback session
This commit is contained in:
parent
7b3f9a1e0c
commit
b2d299dba6
@ -78,6 +78,13 @@ class PlaybackSessionManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async startSession(user, libraryItem, episodeId, options) {
|
async startSession(user, libraryItem, episodeId, options) {
|
||||||
|
// Close any sessions already open for user
|
||||||
|
var userSessions = this.sessions.filter(playbackSession => playbackSession.userId === user.id)
|
||||||
|
for (const session of userSessions) {
|
||||||
|
Logger.info(`[PlaybackSessionManager] startSession: Closing open session "${session.displayTitle}" for user "${user.username}"`)
|
||||||
|
await this.closeSession(user, session, null)
|
||||||
|
}
|
||||||
|
|
||||||
var shouldDirectPlay = options.forceDirectPlay || (!options.forceTranscode && libraryItem.media.checkCanDirectPlay(options, episodeId))
|
var shouldDirectPlay = options.forceDirectPlay || (!options.forceTranscode && libraryItem.media.checkCanDirectPlay(options, episodeId))
|
||||||
var mediaPlayer = options.mediaPlayer || 'unknown'
|
var mediaPlayer = options.mediaPlayer || 'unknown'
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user