public void Release()
 {
     _rendererBuilder.Cancel();
     _rendererBuildingState = RendererBuildingStateIdle;
     _surface = null;
     _player.Release();
 }
Пример #2
0
        /// <summary>
        /// Properly cleanup of your player by releasing resources
        /// </summary>
        public override void OnDestroy()
        {
            var activityManager = (ActivityManager)this.ApplicationContext.GetSystemService(ActivityService);
            var lastTasks       = activityManager.GetRunningTasks(1);

            if (lastTasks?.FirstOrDefault() != null &&
                lastTasks.FirstOrDefault().TopActivity != null &&
                lastTasks.FirstOrDefault().TopActivity.PackageName != null &&
                lastTasks.FirstOrDefault().TopActivity.PackageName != "net.fildo.app")
            {
                Process.KillProcess(Process.MyPid());
            }
            base.OnDestroy();
            if (Player != null)
            {
                Player.Release();
                Player = null;
            }
        }