/// <summary> /// 刷新虚拟显示 /// </summary> private void StartVirtualDisplay() { _imageReader?.Close(); _virtualDisplay?.Release(); _mediaProjection?.Stop(); _mediaProjection = _mediaProjectionManager.GetMediaProjection((int)Result.Ok, _intent); //屏幕宽高 var screenHeight = ScreenMetrics.Instance.GetOrientationAwareScreenHeight(); var screenWidth = ScreenMetrics.Instance.GetOrientationAwareScreenWidth(); InitVirtualDisplay(screenWidth, screenHeight, (int)ScreenMetrics.Instance.DeviceScreenDensity); }
public bool Stop() { StopScript(); if (!ServiceStarted) { return(false); } _virtualDisplay?.Release(); _virtualDisplay = null; _imgListener?.Dispose(); _imgListener = null; _imageReader?.Close(); _imageReader = null; _mediaProjection?.Stop(); _mediaProjection = null; ScreenshotManager.ReleaseMemory(); ImageLocator.ClearCache(); _windowManager.RemoveView(_layout); ServiceStarted = false; HideForegroundNotification(); return(true); }
public void StopRecording() { mediaRecorder.Stop(); mediaProjection.Stop(); recordingDisplay.Release(); Intent stopIntent = new Intent(MainActivity.CurrentActivity, this.Class); stopIntent.SetAction("STOP_SERVICE"); MainActivity.CurrentActivity.StartService(stopIntent); }
private void StopScreenCapture() { if (virtualDisplay == null) { return; } virtualDisplay.Release(); virtualDisplay = null; buttonToggle.SetText(Resource.String.start); }
protected override void OnDestroy() { base.OnDestroy(); mMediaRecorder.Release(); mMediaRecorder.Dispose(); mMediaRecorder = null; mediaProjection.Stop(); mediaProjection = null; virtualDisplay.Release(); virtualDisplay = null; }
public void Stop() { if (!IsRunning) { return; } IsRunning = !IsRunning; var message = ""; try { mediaRecorder.Stop(); mediaRecorder.Reset(); virtualDisplay.Release(); if (PromptDiscard) { var promptDialog = new PromptDialog(DiscardTitle, DiscardMessage); promptDialog.Show(mainActivity.FragmentManager, "PromptDialog"); promptDialog.DiscardClick += (sender, e) => { //删除文件 File.Delete(path); }; promptDialog.PreviewClick += (sender, e) => { showPreviewDialog(); }; } else { showPreviewDialog(); } message = "Completed"; } catch (Exception ex) { message = ex.Message; } finally { RecordCompleted?.Invoke(this, new ErrorEventArgs(message)); } }
private void StopScreenCapture() { try { if (virtualDisplay == null) { return; } //buttonToggle.SetText(Resource.String.start); mMediaRecorder.Stop(); mMediaRecorder.Release(); virtualDisplay.Release(); virtualDisplay = null; } catch (Exception e) { mMediaRecorder.Release(); virtualDisplay.Release(); virtualDisplay = null; } }
public void Dispose() { _convertedMat.Release(); _colorCorrectedMat.Release(); _convertedMat = _colorCorrectedMat = null; _lastestPattern?.Dispose(); _lastestPattern = null; _readBitmap?.Recycle(); _readBitmap = null; _virtualDisplay?.Release(); _virtualDisplay = null; _imageReader?.Close(); _imageReader = null; _mediaProjection?.Stop(); _mediaProjection = null; }