From ce9abe3703f17e16f543470eab86abf91c1e841c Mon Sep 17 00:00:00 2001 From: Rishideep Chatterjee <82643613+rishideepc@users.noreply.github.com> Date: Thu, 20 Jul 2023 22:55:25 +0530 Subject: [PATCH] 2023-07-19 Rishideep surfaceDestroyed bug fix (#65) Fixes crash but leaves version number as 1.8.2.2 without version identifier. --- .../com/example/iris/login1/GalleryActivity.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/example/iris/login1/GalleryActivity.java b/app/src/main/java/com/example/iris/login1/GalleryActivity.java index 69b534a..2874a26 100644 --- a/app/src/main/java/com/example/iris/login1/GalleryActivity.java +++ b/app/src/main/java/com/example/iris/login1/GalleryActivity.java @@ -3003,15 +3003,26 @@ public void surfaceCreated(SurfaceHolder holder) { // the "holder" is get in oncreat() at the beginning surfaceHolder = holder; // 录像线程,当然也可以在别的地方启动,但是一定要在onCreate方法执行完成以及surfaceHolder被赋值以后启动 + + if (thread != null && thread.mPlayer != null) { + thread.mPlayer.setDisplay(surfaceHolder); + } } @Override public void surfaceDestroyed(SurfaceHolder arg0) { // TODO Auto-generated method stub Log.i("SurfaceHolder", "surfaceDestroyed()"); + + if (thread != null && thread.mPlayer != null) { + thread.mPlayer.stop(); + thread.mPlayer.release(); + thread.mPlayer = null; + } //release the resources -/* surfaceview = null; - surfaceHolder = null;*/ + // surfaceview = null; + surfaceHolder = null; + /* mediarecorder mCamera */ if (thread!=null) { thread.stopRecord();