Ejemplo n.º 1
0
        private void _Stop()
        {
            try
            {
                _StopProcess();
                if (m_WakeLock != null && m_WakeLock.IsHeld)
                {
                    m_WakeLock.Release();
                }

                if (m_WifiLock != null && m_WifiLock.IsHeld)
                {
                    m_WifiLock.Release();
                }

                Android.OS.Process.SetThreadPriority(ThreadPriority.Default);
                m_Running = false;
            }
            catch (Exception e)
            {
                e.PrintStackTrace();
            }

            if (m_SnapclientListener != null)
            {
                m_SnapclientListener.OnPlayStateChanged(this);
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// This will release the wifi lock if it is no longer needed
 /// </summary>
 public void ReleaseWifiLock()
 {
     if (wifiLock.IsHeld)
     {
         wifiLock.Release();
     }
 }
Ejemplo n.º 3
0
    public bool ReleaseLock(string lock_type = "screenDim")
    {
        lock (wakeLocks)
        {
            if (!wakeLocks.ContainsKey(lock_type))
            {
                return(false);
            }

            switch (lock_type)
            {
            case "screenDim":
            case "partial":
            case "proximityScreenOff":
                PowerManager.WakeLock pm_lock = (PowerManager.WakeLock)wakeLocks[lock_type];
                pm_lock.Release();
                break;

            case "wifi":
                WifiManager.WifiLock wm_lock = (WifiManager.WifiLock)wakeLocks[lock_type];
                wm_lock.Release();
                break;
            }
            wakeLocks.Remove(lock_type);
            return(true);
        }
    }
Ejemplo n.º 4
0
        public void PausePlayer()
        {
            try
            {
                _player.Pause();
                MediaPlayerState = MediaPlayerState.Paused;
            }
            catch
            {
                MediaPlayerState = MediaPlayerState.None;
            }

            if (_wifiLock.IsHeld)
            {
                _wifiLock.Release();
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// This will release the wifi lock if it is no longer needed
        /// </summary>
        private void ReleaseWifiLock()
        {
            if (_wifiLock == null)
            {
                return;
            }

            _wifiLock.Release();
            _wifiLock = null;
        }
Ejemplo n.º 6
0
        /// <summary>
        /// This will release the wifi lock if it is no longer needed
        /// </summary>
        private void ReleaseWifiLock()
        {
            if (wifiLock == null || !wifiLock.IsHeld)
            {
                return;
            }

            wifiLock.Release();
            wifiLock = null;
        }
Ejemplo n.º 7
0
        public void Release()
        {
            if (_wifiLock != null)
            {
                _wifiLock.Release();
                _wifiLock = null;
            }

            if (_powerWakeLock != null)
            {
                _powerWakeLock.Release();
                _powerWakeLock = null;
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// This will release the wifi lock if it is no longer needed
        /// </summary>
        public void ReleaseWifiLock()
        {
            try
            {
                if (wifiLock == null || !wifiLock.IsHeld)
                {
                    return;
                }
                wifiLock.Release();
            }
            catch (Java.Lang.RuntimeException ex)
            {
                Console.WriteLine(ex.Message);
            }

            wifiLock = null;
        }
Ejemplo n.º 9
0
        private void CleanUp(bool releaseMediaPlayer)
        {
            Logger.Debug("CleanUp");

            _musicService.StopForeground(true);

            if (releaseMediaPlayer && _mediaPlayer != null)
            {
                _mediaPlayer.Reset();
                _mediaPlayer.Release();
                _mediaPlayer = null;
            }

            if (_wifiLock.IsHeld)
            {
                _wifiLock.Release();
            }
        }
Ejemplo n.º 10
0
        void StopHelper()
        {
            currentState = MediaStates.End;

            if (player != null)
            {
                player.Stop();
                player.Release();
                player.Dispose();
            }
            wifiLock.Release();
            wifiLock.Dispose();

            am.UnregisterMediaButtonEventReceiver(mediaComponent);
            am.Dispose();

            mediaComponent.Dispose();

            StopForeground(true);
        }
Ejemplo n.º 11
0
        void RelaxResources(bool releaseMediaPlayer)
        {
            LogHelper.Debug(Tag, "relaxResources. releaseMediaPlayer=", releaseMediaPlayer);

            if (releaseMediaPlayer && mediaPlayer != null)
            {
                if (canUseVisualizer)
                {
                    visualizer.SetEnabled(false);
                    visualizer.Release();
                }

                mediaPlayer.Reset();
                mediaPlayer.Release();
                mediaPlayer = null;
            }

            if (wifiLock.IsHeld)
            {
                wifiLock.Release();
            }
        }
Ejemplo n.º 12
0
 /// <summary>
 /// This will release the wifi lock if it is no longer needed
 /// </summary>
 private void ReleaseWifiLock()
 {
     wifiLock?.Release();
     wifiLock = null;
 }