Skip to content

Commit

Permalink
Update StreamingController.pm
Browse files Browse the repository at this point in the history
Updated based on comments from @philippe44
  • Loading branch information
kwarklabs authored May 1, 2022
1 parent 6d1ac35 commit 25d7e8e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Slim/Player/StreamingController.pm
Original file line number Diff line number Diff line change
Expand Up @@ -916,7 +916,7 @@ sub _RetryOrNext { # -> Idle; IF [shouldretry && canretry] THEN continue
&& $song->isRemote()
&& $elapsed > 10) # have we managed to play at least 10s?
{
if (!$song->duration() || $song->isLive()) { # unknown duration => assume radio
if (!$song->duration() && $song->isLive()) { # unknown duration => assume radio
main::INFOLOG && $log->is_info && $log->info('Attempting to re-stream ', $song->currentTrack()->url, ' after time ', $elapsed);
$song->retryData({ count => 0, start => Time::HiRes::time()});
_Stream($self, $event, {song => $song});
Expand Down Expand Up @@ -960,6 +960,8 @@ sub _Continue {
$song->setStatus(Slim::Player::Song::STATUS_PLAYING);
}
} else {
# This handles resuming after reboot with the caveat that if connection has been lost (no reboot)
# while playing and before reception of next song's 1st byte, we'll resume the current song
main::INFOLOG && $log->is_info && $log->info("Restarting playback at time offset: ". $self->playingSongElapsed());
_JumpToTime($self, $event, {newtime => $self->playingSongElapsed(), restartIfNoSeek => 1});
}
Expand Down Expand Up @@ -1463,7 +1465,7 @@ sub _willRetry {
$retryTime,
sub {
_playersMessage($self, $song->currentTrack()->url, undef, 'RETRYING', undef, undef, 1);
if (!$song->duration() || $song->isLive()) { # unknown duration => assume radio
if (!$song->duration() && $song->isLive()) { # unknown duration => assume radio
main::INFOLOG && $log->is_info && $log->info("Restarting playback at time offset: 0");
_Stream($self, undef, {song => $song, reconnect => 1});
} else {
Expand Down

0 comments on commit 25d7e8e

Please sign in to comment.