HTTP 404 errors not reported back to delegate
I've been trying to deal with stream URLs that sometimes do not work, and needed a way to catch these errors - so implemented the correct delegate methods (e.g. - (void)audioPlayer:(STKAudioPlayer*)audioPlayer unexpectedError:(STKAudioPlayerErrorCode)errorCode) However, the AutoRecoveringHTTPDataSource doesn't catch any errors other than an HTTP 418, and does not report any errors back to the delegate.
I fixed this by changing the code to this in STKAutoRecoveringHTTPDataSource.m - dataSourceErrorOccured: NSLog(@"dataSourceErrorOccured");
if (self.innerDataSource.httpStatusCode == 416 /* Range out of bounds */)
{
[super dataSourceEof:dataSource];
} else if (self.innerDataSource.httpStatusCode == 404 /* Not Found */) {
[super dataSourceErrorOccured:dataSource];
}
else
{
[self processRetryOnError];
}
Can you tell me if this is right? It seems to work... I hope it helps others too.
That's fine if you need to handle 404s but the whole point of the auto recovering data source is that it keeps retrying until the server comes back online (maybe the file was missing cause the volume dropped off etc).
OK, but it doesn't keep retrying indefinitely - it does give up after a number of retries, but even then doesn't report that anything was wrong; it gives an EOF status. IMHO, it would be better to retry a few times, and then report the status back to the delegate. The delegate can then decide if it wants to keep trying until the resource is there.
So it's a bug that it retries indefinitely, right?
See https://github.com/tumtumtum/StreamingKit/issues/398#issuecomment-501791223