@@ -411,24 +411,24 @@ impl TracksId {
411411
412412impl Playback {
413413 /// creates new playback with a specified offset based on the current playback
414- pub fn uri_offset ( & self , uri : String ) -> Self {
414+ pub fn uri_offset ( & self , uri : String , limit : usize ) -> Self {
415415 match self {
416416 Playback :: Context ( id, _) => {
417417 Playback :: Context ( id. clone ( ) , Some ( rspotify_model:: Offset :: Uri ( uri) ) )
418418 }
419419 Playback :: URIs ( ids, _) => {
420- let ids = if ids. len ( ) < super :: PLAYBACK_TRACKS_LIMIT {
420+ let ids = if ids. len ( ) < limit {
421421 ids. clone ( )
422422 } else {
423423 let pos = ids
424424 . iter ( )
425425 . position ( |id| id. uri ( ) == uri)
426426 . unwrap_or_default ( ) ;
427- let l = pos. saturating_sub ( super :: PLAYBACK_TRACKS_LIMIT / 2 ) ;
428- let r = std:: cmp:: min ( l + super :: PLAYBACK_TRACKS_LIMIT , ids. len ( ) ) ;
427+ let l = pos. saturating_sub ( limit / 2 ) ;
428+ let r = std:: cmp:: min ( l + limit , ids. len ( ) ) ;
429429 // For a list with too many tracks, to avoid payload limit when making the `start_playback`
430430 // API request, we restrict the range of tracks to be played, which is based on the
431- // playing track's position (if any) and the application's limit (PLAYBACK_TRACKS_LIMIT ).
431+ // playing track's position (if any) and the application's limit (`app_config.tracks_playback_limit` ).
432432 // Related issue: https://github.com/aome510/spotify-player/issues/78
433433 ids[ l..r] . to_vec ( )
434434 } ;
0 commit comments