async void Player_StreamLoaded(object sender, object e) { isPaused = true; AddLog(new StreamEventLog(StreamEventType.Loaded, TimeSpan.Zero, Player.Duration)); var loadedLog = new StreamLoadedLog(Player.Source); if (AdaptiveMonitor != null) { loadedLog.MaxBitrate = AdaptiveMonitor.MaxBitrate; loadedLog.MinBitrate = AdaptiveMonitor.MinBitrate; } EdgeServerResult edgeResult = EdgeServerResult.Empty; if (Player.Source.IsAbsoluteUri) { var sourceRoot = GetUrlWithoutQueryString(Player.Source); try { edgeResult = await GetEdgeServerAsync(new Uri(sourceRoot, UriKind.Absolute)); } catch (OperationCanceledException) { /* ignore */ } } loadedLog.EdgeServer = edgeResult.EdgeServer; loadedLog.ClientIp = edgeResult.ClientIP; AddLog(loadedLog); streamLoadedLog = loadedLog; }
async Task <EdgeServerResult> GetEdgeServerAsync(Uri currentStreamUri) { EdgeServerResult result = null; if (EdgeServerMonitor != null) { try { #if SILVERLIGHT result = await EdgeServerMonitor.GetEdgeServerAsync(currentStreamUri, cts.Token); #else result = await EdgeServerMonitor.GetEdgeServerAsync(currentStreamUri).AsTask(cts.Token); #endif } catch (OperationCanceledException) { throw; } catch { /* unable to get edge server info, nothing we can do but continue */ } } return(result ?? EdgeServerResult.Empty); }