How to manage errors related to the URL or to connectivity?
See original GitHub issueHello,
I use the XamarinMediaManager in a Xamarin.Forms project, to play audio from a web radio.
But I would like to manage error cases, like when the URL is no longer available, or if there is not internet access for example.
I launch the audio stream like this:
var mediaItem = await CrossMediaManager.Current.Play(audioUrl);
If I use a “wrong” URL, nothing happens, but I didn’t found how to “identify” this case. It’s the same thing if I activate the airplane mode.
I would like to display an error message to the user in both cases, so he could understand why the audio doesn’t launch.
Is there a way to manage this?
Issue Analytics
- State:
- Created 3 years ago
- Comments:7
Top Results From Across the Web
Handling operation errors - Apollo GraphQL Docs
Executing GraphQL operations on a remote server can result in GraphQL errors or network errors. GraphQL errors. These are errors related to the...
Read more >Fix connection errors - Google Chrome Help
Fix most connection errors If you go to a website and get an error, try these troubleshooting steps first: Check the web address...
Read more >Manage errors | Error Reporting
To view the issues associated with an error group, click the link icon link: If the error group isn't associated with an issue...
Read more >How to Fix the ERR_CONNECTION_RESET Error in 7 Ways
If the issue persists, try opening the website using another device that's connected properly to the same network. If the error message still ......
Read more >8 Common Webpage Errors & How to Fix Them
You can usually fix this error by reviewing the URL of the page that is causing the error; it's possible that the link...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
From the top of my head: there’s a OnMetadataUpdated that you can subscribe to for updates. mediaItem.MetadataUpdated += (sender, args) => { var title = args.MediaItem.Title; // Perhands check for null values and act accordingly. };
I’ve did some investigations, and it seems that the behaviour is not the same on iOS and Android.
As a reminder, I would like to manage errors that can occur when the user try to play a webradio stream.
On Android, I use the
MediaItemFailed
event, that is raised after 1 minute:CrossMediaManager.Current.MediaItemFailed += OnCurrentMediaItemFailed;
On iOS the event is not raised, so I check the
MediaItem.Title
like this:But in both cases, I would to display an error message to the user, and to reset
CrossMediaManager.Current.State
toStopped
.For this, I call the
Stop()
method when an issue is detected:await CrossMediaManager.Current.Stop();
But this seems only working on Android. On iOS, the
State
is stillPause
orBuffering
after this…Is there any explanation?