Пример #1
0
        async void VlcPlayerService_MediaEnded(object sender, Player e)
        {
            await DispatchHelper.InvokeAsync(() =>
            {
                MediaControl.IsPlaying = false;
                UnregisterMediaControls();

                var mediaEnded = MediaEnded;
                if (mediaEnded != null)
                {
                    mediaEnded(this, new EventArgs());
                }
            });
        }
Пример #2
0
        public void Close()
        {
            if (_vlcPlayer != null)
            {
                if (CurrentState != MediaPlayerState.Stopped)
                {
                    Stop();
                }

                lock (_controlLock)
                {
                    if (_vlcInitializeTask != null)
                    {
                        _vlcInitializeTask.Wait(20000);
                        _vlcInitializeTask = null;
                        GC.Collect();
                    }
                }

                lock (_controlLock)
                {
                    try
                    {
                        _vlcPlayer.Dispose();
                        _vlcPlayer = null;
                    }
                    catch (Exception ex)
                    {
                        Debug.WriteLine("We ran into an exception disposing vlc instance");
                        Debug.WriteLine(ex);
                    }
                }
            }
        }
Пример #3
0
        private async void VlcPlayerServiceOnMediaEnded(object sender, Player player)
        {
            UnRegisterMediaControlEvents();
            _vlcPlayerService.MediaEnded -= VlcPlayerServiceOnMediaEnded;
#if WINDOWS_PHONE_APP
            await DispatchHelper.InvokeAsync(() => App.ApplicationFrame.GoBack());
#endif
#if NETFX_CORE
            await DispatchHelper.InvokeAsync(() => App.RootPage.MainFrame.GoBack());
#endif
        }
Пример #4
0
 public async Task Initialize(SwapChainBackgroundPanel panel)
 {
     _vlcPlayer = new Player(panel);
     _vlcInitializeTask = _vlcPlayer.Initialize().AsTask();
     _vlcPlayer.MediaEnded += _vlcPlayer_MediaEnded;
     await _vlcInitializeTask;
 }