Beispiel #1
0
        /// <summary>
        /// Closes the current video.
        /// This method returns immediately if there is no video playing.
        /// </summary>
        public async Task CloseVideoAsync()
        {
            // Handle current state
            if (this.State != MediaPlayerState.Playing)
            {
                return;
            }
            this.State = MediaPlayerState.Closing;

            try
            {
                // Call close and wait for result
                Task <MF.MediaEvent> closeSessionTask = m_sessionEventHandler.WaitForEventAsync(
                    MF.MediaEventTypes.SessionClosed,
                    CancellationToken.None);
                m_mediaSession.Close();
                await closeSessionTask;
            }
            finally
            {
                // Disposes all resources
                this.DisposeResources();
            }

            //VideoFinished.Raise(this, EventArgs.Empty);
            VideoClosed.Raise(this, EventArgs.Empty);
        }
Beispiel #2
0
 private void buttonClose_Click(object sender, EventArgs e)
 {
     VideoClosed?.Invoke(this, e);
 }
Beispiel #3
0
 private void OnVideoClosed()
 {
     VideoClosed?.Invoke(this, EventArgs.Empty);
 }