コード例 #1
0
 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;
            }
        }