Fix ios infinite loop when timerange does not exist #209
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
When I loaded a .m3u8 file which was 0 seconds.
The AudioPlayer.m went into an infinite loop.
It was checking for timeRanges which was never there.
This way we couldn't destroy the audio player.
If the loadedTimeRanges.firstObject is nil and status is AVPlayerItemStatusReadyToPlay. The player should have loadedTimeRanges. When this is not the case we should return with error.
Otherwise we stay in the infinite loop.
Test Plan
What's required for testing (prerequisites)?
A .m3u8 file which is has 0 seconds.
Not sure how long this url will be valid.
https://content.mediadistillery.tv/api/3/playout/097506e997b9445b38cf86961affd195a864522d25a536ed650dbbb4d93b89c5879e756c211239a5c04d72546869732069792061207784.m3u8?protocol=https&cursor=0
What are the steps to reproduce (after prerequisites)?
Load the provided url.
Compatibility
Checklist
CHANGELOG.md