Beispiel #1
0
            protected virtual void Dispose(bool disposing)
            {
                if (!disposedValue)
                {
                    if (disposing)
                    {
                        // TODO: dispose managed state (managed objects).
                    }

                    // TODO: free unmanaged resources (unmanaged objects) and override a finalizer below.
                    // TODO: set large fields to null.
#if __IOS__
                    m_audioTrack?.Stop();
                    m_audioTrack?.Dispose();
                    m_memory?.Dispose();
                    m_memory = null;
#elif __ANDROID__
                    m_audioTrack?.Stop();
                    m_audioTrack?.Flush();
                    m_audioTrack?.Release();
                    m_audioTrack?.Dispose();
#elif NETFX_CORE
                    m_audioTrack?.Pause();
                    m_memory?.Flush();
                    m_memory?.Dispose();
                    m_memory = null;
#endif
                    m_audioTrack  = null;
                    disposedValue = true;
                }
            }
Beispiel #2
0
 private void Slider_PointerReleased(object sender, PointerRoutedEventArgs e)
 {
     if (PlaybackEngine.PlaybackEngine.Current.IsPlaying == null || PlaybackEngine.PlaybackEngine.Current.IsPlaying == false)
     {
         var player = new Windows.Media.Playback.MediaPlayer
         {
             Source = Windows.Media.Core.MediaSource.CreateFromUri(new Uri("ms-winsoundevent:Notification.Reminder"))
         };
         player.Volume      = Settings.Current.PlayerVolume / 100d;
         player.MediaEnded += (a, v) =>
         {
             player.Dispose();
         };
         player.Play();
     }
 }
        /// <summary>
        /// end the current cast session, and call CastEnd event
        /// </summary>
        /// <param name="sendEvent">should CastEnd be called?</param>
        void EndCurrentSession(bool sendEvent)
        {
            currentPlayer?.Pause();
            currentPlayer?.Dispose();
            currentPlayer = null;

            CurrentConnection?.Disconnect(MiracastReceiverDisconnectReason.Finished);
            CurrentConnection = null;

            currentSession?.Dispose();
            currentSession = null;

            if (sendEvent)
            {
                CastEnd?.Invoke();
            }
        }
Beispiel #4
0
            public async void Stop()
            {
                if (m_PlayThread != Unit.CompletedTask)
                {
                    try
                    {
                        cancellation.Cancel();
                        await m_PlayThread;
                    }
                    catch (Exception)
                    {
                    }
                }
                if (m_audioTrack != null)
                {
#if !WINDOWS_UWP
                    m_audioTrack.Stop();
                    m_audioTrack.Dispose();
#else
                    m_audioTrack.Pause();
#endif
                    m_audioTrack = null;
                }
            }