Example #1
0
 private void OnPlaybackStopped(int handle, int channel, int data, IntPtr user)
 {
     OnPlaybackEnded?.Invoke(this, null);
     tmrUpdatePosition.Stop();
     PlaybackState = PlaybackStates.STOPPED;
     OnPlaybackStateChanged?.Invoke(this, PlaybackStates.STOPPED);
 }
Example #2
0
        public void Play(ent::Song song)
        {
            if (IsPaused)
            {
                waveOut.Resume();
                IsPaused = false;
            }
            else
            {
                //MessageBox.Show("" + new Mp3FileReader(song.Uri).TotalTime);
                song.Should().NotBeNull();
                this.Stop();

                waveOut = new WaveOut();
                var mp3FileReader = new Mp3FileReader(song.Uri);
                waveOut.Init(mp3FileReader);
                waveOut.Play();
                waveOut.PlaybackStopped += (sender, args) => OnPlaybackEnded?.Invoke();

                this.IsPaused    = false;
                this.IsPlaying   = true;
                this.PlayingSong = song;
            }
        }