@@ -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,30 @@ 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 ?. Type === 'Episode' ) {
3172+ const apiClient = ServerConnections . getApiClient ( item . ServerId ) ;
3173+ const episodes = await apiClient . getEpisodes ( item . SeriesId , {
3174+ adjacentTo : item . Id
3175+ } ) ;
3176+ const newEpisodeIndex = episodes . Items . findIndex ( i => i . Id == item . Id ) - 1 ;
3177+
3178+ const newItem = episodes . Items [ newEpisodeIndex ] ;
3179+
3180+ if ( newItem ) {
3181+ const newItemPlayOptions = newItem . playOptions || getDefaultPlayOptions ( ) ;
3182+ newItemPlayOptions . startPositionTicks = 0 ;
3183+
3184+ playInternal ( newItem , newItemPlayOptions , function ( ) {
3185+ self . _playQueueManager . queueNext ( [ newItem ] ) ;
3186+ Events . trigger ( player , 'playlistitemadd' ) ;
3187+ self . movePlaylistItem ( newItem . PlaylistItemId , 0 , player ) ;
3188+ setPlaylistState ( newItem . PlaylistItemId , 0 ) ;
3189+ } , getPreviousSource ( player ) ) ;
3190+ }
3191+ }
31683192 }
31693193 } ;
31703194
0 commit comments