@@ -29,6 +29,7 @@ import '../services/jukebox_service.dart';
2929import '../services/audio_handler.dart' ;
3030import '../services/fade_settings_service.dart' ;
3131import '../services/lock_screen_lyrics_service.dart' ;
32+ import '../services/transcoding_service.dart' ;
3233import '../providers/library_provider.dart' ;
3334
3435enum RepeatMode { off, all, one }
@@ -103,6 +104,7 @@ class PlayerProvider extends ChangeNotifier with WidgetsBindingObserver {
103104 bool _isFading = false ;
104105
105106 final JukeboxService _jukeboxService;
107+ final TranscodingService _transcodingService;
106108
107109 double _playbackSpeed = 1.0 ;
108110 double _pitch = 1.0 ;
@@ -115,6 +117,7 @@ class PlayerProvider extends ChangeNotifier with WidgetsBindingObserver {
115117 this ._upnpService,
116118 this ._audioHandler,
117119 this ._jukeboxService,
120+ this ._transcodingService,
118121 ) {
119122 _storageService = storageService;
120123 _discordRpcService = DiscordRpcService (storageService);
@@ -1593,7 +1596,15 @@ class PlayerProvider extends ChangeNotifier with WidgetsBindingObserver {
15931596 if (offlinePath != null ) {
15941597 playUrl = 'file://$offlinePath ' ;
15951598 } else {
1596- playUrl = await _subsonicService.resolveStreamUrlAsync (song);
1599+ // Apply transcoding settings if enabled
1600+ final maxBitRate = _transcodingService.enabled
1601+ ? _transcodingService.currentBitRate
1602+ : null ;
1603+ final format = _transcodingService.enabled
1604+ ? _transcodingService.format
1605+ : null ;
1606+ playUrl = _subsonicService.getStreamUrl (song.id,
1607+ maxBitRate: maxBitRate, format: format);
15971608 }
15981609 }
15991610 // Cache remote streams locally so seeking works even when the
@@ -2388,7 +2399,13 @@ class PlayerProvider extends ChangeNotifier with WidgetsBindingObserver {
23882399 if (offlinePath != null ) {
23892400 return AudioSource .uri (Uri .file (offlinePath));
23902401 }
2391- final url = _subsonicService.getStreamUrl (song.id);
2402+ // Apply transcoding settings if enabled
2403+ final maxBitRate =
2404+ _transcodingService.enabled ? _transcodingService.currentBitRate : null ;
2405+ final format =
2406+ _transcodingService.enabled ? _transcodingService.format : null ;
2407+ final url = _subsonicService.getStreamUrl (song.id,
2408+ maxBitRate: maxBitRate, format: format);
23922409 // Cache remote streams locally so seeking works even when the server
23932410 // transcodes and doesn't support HTTP range requests (issue #170).
23942411 final cacheDir = await getTemporaryDirectory ();
0 commit comments