public void TestInitialize() { _httpClients = Substitute.For <IHttpClients>(); _httpClient = Substitute.For <IHttpClient>(); _httpClients.Client().Returns(_httpClient); }
private void InitMediaPlayer() { _mediaElementManager = new MediaElementManager(Dispatcher, () => { UpdateState(MediaElementState.Opening); return(TiviMediaElement); }, me => UpdateState(MediaElementState.Closed)); _httpClients = new HttpClients(userAgent: ApplicationInformation.CreateUserAgent()); _positionTimer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(1) }; _positionTimer.Tick += OnPositionSamplerOnTick; if (null == TiviMediaElement) { Debug.WriteLine("MainPage Play no media element"); return; } InitializeMediaStream(); if (!string.IsNullOrEmpty(_streamLink)) { _mediaStreamFascade.Source = new Uri(_streamLink); } }
// Constructor public LivePlayer() { InitializeComponent(); _mediaElementManager = new MediaElementManager(Dispatcher, () => { UpdateState(MediaElementState.Opening); return(mediaElement1); }, me => UpdateState(MediaElementState.Closed)); _httpClients = new HttpClients(userAgent: ApplicationInformation.CreateUserAgent()); _positionSampler = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(75) }; _positionSampler.Tick += OnPositionSamplerOnTick; #if STREAM_SWITCHING _timer = new DispatcherTimer(); _timer.Tick += (sender, args) => { GC.Collect(); GC.WaitForPendingFinalizers(); GC.Collect(); var gcMemory = GC.GetTotalMemory(true).BytesToMiB(); var source = Sources[_count]; Debug.WriteLine("Switching to {0} (GC {1:F3} MiB App {2:F3}/{3:F3}/{4:F3} MiB)", source, gcMemory, DeviceStatus.ApplicationCurrentMemoryUsage.BytesToMiB(), DeviceStatus.ApplicationPeakMemoryUsage.BytesToMiB(), DeviceStatus.ApplicationMemoryUsageLimit.BytesToMiB()); InitializeMediaStream(); _mediaStreamFascade.Source = null == source ? null : new Uri(source); if (++_count >= Sources.Length) { _count = 0; } _positionSampler.Start(); }; _timer.Interval = TimeSpan.FromSeconds(15); _timer.Start(); #endif // STREAM_SWITCHING }
public BlockedTraffic(IHttpClients httpClients, Uri p2PStatusUri, TimeSpan timeout) { Ensure.NotNull(httpClients, nameof(httpClients)); Ensure.NotNull(p2PStatusUri, nameof(p2PStatusUri)); _p2PStatusUri = p2PStatusUri; _httpClient = httpClients.Client(); _httpClient.Timeout = timeout; }
// Constructor public LivePlayer() { InitializeComponent(); _mediaElementManager = new MediaElementManager(Dispatcher, () => { UpdateState(MediaElementState.Opening); return mediaElement1; }, me => UpdateState(MediaElementState.Closed)); _httpClients = new HttpClients(userAgent: ApplicationInformation.CreateUserAgent()); _positionSampler = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(75) }; _positionSampler.Tick += OnPositionSamplerOnTick; #if STREAM_SWITCHING _timer = new DispatcherTimer(); _timer.Tick += (sender, args) => { GC.Collect(); GC.WaitForPendingFinalizers(); GC.Collect(); var gcMemory = GC.GetTotalMemory(true).BytesToMiB(); var source = Sources[_count]; Debug.WriteLine("Switching to {0} (GC {1:F3} MiB App {2:F3}/{3:F3}/{4:F3} MiB)", source, gcMemory, DeviceStatus.ApplicationCurrentMemoryUsage.BytesToMiB(), DeviceStatus.ApplicationPeakMemoryUsage.BytesToMiB(), DeviceStatus.ApplicationMemoryUsageLimit.BytesToMiB()); InitializeMediaStream(); _mediaStreamFascade.Source = null == source ? null : new Uri(source); if (++_count >= Sources.Length) _count = 0; _positionSampler.Start(); }; _timer.Interval = TimeSpan.FromSeconds(15); _timer.Start(); #endif // STREAM_SWITCHING }
public BlockedTraffic(IHttpClients httpClients, Uri p2PStatusUri, TimeSpan timeout) { Ensure.NotNull(httpClients, nameof(httpClients)); Ensure.NotNull(p2PStatusUri, nameof(p2PStatusUri)); _p2PStatusUri = p2PStatusUri; _httpClient = httpClients.Client(new HttpClientHandler { UseCookies = false }); _httpClient.Timeout = timeout; }
public static IMediaStreamFascade Create(this MediaStreamFascadeParameters parameters, IHttpClients httpClients, Func <SM.Media.MediaParser.IMediaStreamSource, System.Threading.Tasks.Task> mediaStreamSourceSetter);
public void TestInitialize() { _httpClients = Substitute.For <IHttpClients>(); _httpClient = Substitute.For <IHttpClient>(); _httpClients.Client(default).ReturnsForAnyArgs(_httpClient);
public static IMediaStreamFascade Create(this MediaStreamFascadeParameters parameters, IHttpClients httpClients, Func<SM.Media.MediaParser.IMediaStreamSource, System.Threading.Tasks.Task> mediaStreamSourceSetter);