-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Plugin does not handle streaming errors gracefully #8
Comments
Hi @robincsmith yep I struggled with this one. Seems the errors aren't always surfaced. Will take another crack at it. |
Awesome, thanks! The 'BAD' url above should generate a 401 or 403 error, which should be enough to reproduce the problem (or, you can use any SoundCloud URL without specifying a valid client_id). I guess if the streaming URL does result in a 4xx error, it would be good to catch that and make sure the next track starts playback without any issues. Other than that, the error handling seems good - I'm not too familiar with Objective-C but it seems like the 'bad track' gets removed from the playlist after the user first tries to stream it? |
@codinronan I've had the chance to play with this a bit in an application now, and it seems the player automatically tries to 'skip' past the offending track and play the next one. Sometimes this works really well, and the next / previous track starts playing, but other times it doesn't work so well - the new track can be muted, or you can't skip back past a certain point in the playlist. Would it be possible to throw some kind of status error up to the application, and let it decide how to handle this? Or might this interrupt the continuous lockscreen / background playback? Even if it's better to handle the error in this plugin, it would be really useful to get an error status thrown up to the application somehow, so that appropriate action can be taken (greying out the track in the UI / displaying an error message to the user, for example) |
I think the best way to handle this is by catching |
Expected Behaviour
When the HTTP request to stream a playlist track is rejected (i.e. the response is an HTTP 4xx client error), the playlist should handle this gracefully, by continuing on to the next track on the playlist (or the previous track, if the user was skipping backwards through the playlist)
Actual Behaviour
The lockscreen UI indicates that the next track is playing, but no music can be heard. It is possible to work around the issue by skipping back and forwards through the tracks, which can cause the music to start playing again.
Reproduce Scenario (including but not limited to)
iOS with Ionic, streaming tracks from SoundCloud using stream URLs
Steps to Reproduce
Create a playlist with at least two valid streaming tracks. In between the two valid tracks, have another streaming track with URL
https://api.soundcloud.com/tracks/274436003/stream?client_id=abcdefg
- using an invalid SoundCloud key as shown here will cause an HTTP 401 error, which should be enough to reproduce the error.Play the first track, and skip forward, or wait for the first track to end. The invalid track will be skipped over, and the lockscreen controls will display track information and playback information suggesting the next valid track is playing, when in fact no music is being played by the device.
Platform and Version
iOS 11.4
Cordova CLI version and cordova platform version
Cordova CLI version 7.1.0
Sample Code that illustrates the problem
Logs taken while reproducing problem
The text was updated successfully, but these errors were encountered: