コード例 #1
0
        public static void StartStream()
        {
            _initialized     = false;
            _wo              = new WaveOut();
            _listenMoeThread = new Thread(() =>
            {
                using (var mf = new MediaFoundationReader(Url))
                {
                    _wo.Init(mf);
                    _initialized = true;

                    while (true)
                    {
                        Thread.Sleep(1000 * 60 * 60 * 24); // 1 day because this loop literally does nothing
                    }
                }
            });

            _listenMoeThread.Start();

            while (!_initialized)
            {
                Thread.Sleep(100);
            }

            _wo.Volume = Properties.Settings.Default.volume;
            _wo.Play();
            IsPlaying = true;
            PlayingStateChanged?.Invoke();
            SongDataChanged?.Invoke();
        }
コード例 #2
0
        public static void StopStream(bool shuttingDown = false)
        {
            _wo.Stop();

            if (!shuttingDown)
            {
                IsPlaying = false;
                PlayingStateChanged?.Invoke();
            }

            _listenMoeThread.Abort();
        }