Skip to content

Commit

Permalink
When playing an episode, always take the duration from the MP3 if ava…
Browse files Browse the repository at this point in the history
…ilable. Fixes issue where duration in RSS may be very different to that of the actual MP3 once DAI had been applied.
  • Loading branch information
amugofjava committed Aug 27, 2024
1 parent 0c3b5a7 commit e46873f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/services/audio/default_audio_player_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -872,9 +872,9 @@ class _DefaultAudioPlayerHandler extends BaseAudioHandler with SeekHandler {
try {
var duration = await _player.setAudioSource(source, initialPosition: start);

/// If we don't already have a duration and we have been able to calculate it from
/// beginning to fetch the media, update the current media item with the duration.
if (duration != null && (_currentItem!.duration == null || _currentItem!.duration!.inSeconds == 0)) {
/// As duration returned from the player library can be different from the duration in the feed - usually
/// because of DAI - if we have a duration from the player, use that.
if (duration != null) {
_currentItem = _currentItem!.copyWith(duration: duration);
}

Expand Down

0 comments on commit e46873f

Please sign in to comment.