@@ -3146,7 +3146,7 @@ export class PlaybackManager {
31463146 }
31473147 } ;
31483148
3149- self . previousTrack = function ( player ) {
3149+ self . previousTrack = async function ( player ) {
31503150 player = player || self . _currentPlayer ;
31513151 if ( player && ! enableLocalPlaylistManagement ( player ) ) {
31523152 return player . previousTrack ( ) ;
@@ -3165,6 +3165,26 @@ export class PlaybackManager {
31653165 setPlaylistState ( newItem . PlaylistItemId , newIndex ) ;
31663166 } , getPreviousSource ( player ) ) ;
31673167 }
3168+ } else {
3169+ const state = self . getPlayerState ( player ) ;
3170+ const item = state . NowPlayingItem ;
3171+ if ( item && item . Type === 'Episode' ) {
3172+ const apiClient = ServerConnections . getApiClient ( item . ServerId ) ;
3173+ const episodes = await apiClient . getEpisodes ( item . SeriesId ) ;
3174+ const newEpisodeIndex = episodes . Items . findIndex ( i => i . Id == item . Id ) - 1 ;
3175+
3176+ const newItem = episodes . Items [ newEpisodeIndex ] ;
3177+
3178+ if ( newItem ) {
3179+ const newItemPlayOptions = newItem . playOptions || getDefaultPlayOptions ( ) ;
3180+ newItemPlayOptions . startPositionTicks = 0 ;
3181+
3182+ playInternal ( newItem , newItemPlayOptions , function ( ) {
3183+ self . _playQueueManager . getPlaylist ( ) . unshift ( newItem ) ;
3184+ setPlaylistState ( newItem . PlaylistItemId , 0 ) ;
3185+ } , getPreviousSource ( player ) ) ;
3186+ }
3187+ }
31683188 }
31693189 } ;
31703190
0 commit comments