Beispiel #1
0
            public Play
            (
                ent::Song songToPlay
            )
            {
                songToPlay.Should().NotBeNull();

                this.songToPlay = songToPlay;
            }
Beispiel #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;
            }
        }