public void Play()
 {
     if (task.Status == PlayerStatus.Paused)
     {
         task.Resume();
     }
     else
     {
         Stop();
         SpinWait.SpinUntil(() => task.Status == PlayerStatus.Stopped);
         if (task != null)
         {
             task.Dispose();
         }
         task = new CorePlayer(this);
         InitializeVorbisBuffer();
         start_time = DateTime.Now;
         task.Start();
     }
     view.SetPlayState();
     activity.RegisterReceiver(headset_status_receiver, new IntentFilter(AudioManager.ActionAudioBecomingNoisy));
 }
 public void Play()
 {
     if (task.Status == PlayerStatus.Paused)
         task.Resume ();
     else {
         Stop ();
         SpinWait.SpinUntil(() => task.Status == PlayerStatus.Stopped);
         if (task != null)
             task.Dispose ();
         task = new CorePlayer (this);
         InitializeVorbisBuffer ();
         start_time = DateTime.Now;
         task.Start ();
     }
     view.SetPlayState ();
     activity.RegisterReceiver (headset_status_receiver, new IntentFilter(AudioManager.ActionAudioBecomingNoisy));
 }