public void ReceiveError(MediaError mediaError) { if (OnError.HasDelegate) { OnError.InvokeAsync(mediaError); } }
public async Task OnErrorEventHandler(string currentSrc) { PlayerState.CurrentSrc = new Uri(currentSrc); PlayerState.PlayState = BulMediaPlayState.Stopped; PlayerState.CanPlay = false; await OnError.InvokeAsync(PlayerState); StateHasChanged(); }
public async Task WatchPositionError(PositionError error) { GeolocationSensorService.NotifyPositionError(error); await OnError.InvokeAsync(error); }
private void Listen() { while (!dispose) { var buffers = new List <byte[]>(); WebSocketReceiveResult msgInfo = null; try { while (!msgInfo?.EndOfMessage ?? true) { var b = new ArraySegment <byte>(new byte[bufferSize]); msgInfo = socket.ReceiveAsync(b, socketTokenSource.Token).Result; var bArray = b.Array; Array.Resize(ref bArray, msgInfo.Count); buffers.Add(bArray); } } catch (AggregateException ex) when(ex.InnerException?.GetType() == typeof(TaskCanceledException)) { OnClose.InvokeAsync(); return; } catch (Exception e1) { OnError?.Invoke(e1); if (!AutoReconnect) { return; } try { socketTokenSource.Token.WaitHandle.WaitOne(1000); ConnectAsync().Wait(); } catch (Exception e2) { OnReconnectFailed.InvokeAsync(); OnError.InvokeAsync(e2); OnClose.InvokeAsync(); } return; } var buffer = new List <byte>(); foreach (var b in buffers) { buffer.AddRange(b); } Task.Run(() => HandleNewMessage(msgInfo, buffer.ToArray())); } OnClose.InvokeAsync(); }
public async Task NotifyAmbientLightError(string error) { AmbientLightSensorService.NotifyAmbientLightError(error); await OnError.InvokeAsync(error); }