public async void Finish() { StreamProcessor.CloseConnection(); var dispatcher = SystemUtil.GetCurrentDispatcher(); if (dispatcher != null) { await dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { MoviePlaybackData.Image = null; }); } if (AvContent == null) { return; } try { await AvContent.StopStreamingAsync().ConfigureAwait(false); } catch (Exception) { DebugUtil.Log("Failed to stop movie stream"); } finally { AvContent = null; } }
public static async Task <bool> ReOpenLiveviewStream(DeviceApiHolder api, StreamProcessor liveview) { DebugUtil.Log(() => "Reopen liveview stream"); liveview.CloseConnection(); await Task.Delay(2000).ConfigureAwait(false); return(await OpenLiveviewStream(api, liveview).ConfigureAwait(false)); }
public static async Task <bool> CloseLiveviewStream(DeviceApiHolder api, StreamProcessor liveview) { DebugUtil.Log(() => "Close liveview stream"); try { liveview.CloseConnection(); await api.Camera.StopLiveviewAsync().ConfigureAwait(false); return(true); } catch (RemoteApiException e) { DebugUtil.Log(() => "Failed to stopLiveview: " + e.StatusCode); return(false); } }
public static async Task TearDown(TargetDevice device, StreamProcessor liveview) { if (liveview != null) { if (device != null) { await CloseLiveviewStream(device.Api, liveview); } else { liveview.CloseConnection(); } } if (device != null) { device.Observer.Stop(); } }