示例#1
0
        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;
            }
        }
示例#2
0
        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));
        }
示例#3
0
        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);
            }
        }
示例#4
0
        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();
            }
        }