Beispiel #1
0
        public void Play()
        {
            IsPlaying = true;

            if (PlayingURI != Source || Playback == null)
            {
                if (Playback != null)
                {
                    Playback.Dispose();
                }

                Playback = new StreamingPlayback();

                NSError error;
                var     session = AVAudioSession.SharedInstance();
                session.SetCategory(AVAudioSessionCategory.Playback, AVAudioSessionCategoryOptions.DefaultToSpeaker);
                session.OverrideOutputAudioPort(AVAudioSessionPortOverride.Speaker, out error);

                Playback.Play(Source);
                PlayingURI = Source;
            }
            else if (PlayingURI == Source)
            {
                Playback.Play();
            }
        }
Beispiel #2
0
        public AudioPlayer()
        {
            Playback = new StreamingPlayback();

            NSError error;
            var     session = AVAudioSession.SharedInstance();

            session.SetCategory(AVAudioSessionCategory.Playback, AVAudioSessionCategoryOptions.DefaultToSpeaker);
            session.OverrideOutputAudioPort(AVAudioSessionPortOverride.Speaker, out error);
        }
Beispiel #3
0
 public void Stop()
 {
     Playback.Stop();
     Playback  = null;
     IsPlaying = false;
 }