android api2,Android Camera 2 Api

I have been trying camera2 API. I have downloaded code from

https://developer.android.com/samples/Camera2Video/index.html to learn about how it works. It works fine till I stop recording. When I stop recording it runs following code.

private void stopRecordingVideo() {

// UI

mIsRecordingVideo = false;

mBtn_Video.setText(R.string.record);

// Stop recording

try {

mMediaRecorder.stop();

mMediaRecorder.reset();

}

catch (Exception e) {

e.printStackTrace();

}

Activity activity = getActivity();

if (null != activity) {

System.out.println("file " + getVideoFile(activity));

Toast.makeText(activity, "Video saved: " + getVideoFile(activity),

Toast.LENGTH_SHORT).show();

}

startPreview();

at mMediaRecorder.stop(); it throw following error

01-12 16:24:23.115 2161-2200/com.cameratwoapi E/Surface﹕ queueBuffer: error queuing buffer to SurfaceTexture, -19

01-12 16:24:23.135 2161-2200/com.cameratwoapi E/EGL_emulation﹕ tid 2200: swapBuffers(285): error 0x3003 (EGL_BAD_ALLOC)

01-12 16:24:23.197 2161-2200/com.cameratwoapi E/CameraDeviceGLThread-0﹕ Received exception on GL render thread:

java.lang.IllegalStateException: swapBuffers: EGL error: 0x3003

at android.hardware.camera2.legacy.SurfaceTextureRenderer.checkEglError(SurfaceTextureRenderer.java:487)

at android.hardware.camera2.legacy.SurfaceTextureRenderer.swapBuffers(SurfaceTextureRenderer.java:480)

at android.hardware.camera2.legacy.SurfaceTextureRenderer.drawIntoSurfaces(SurfaceTextureRenderer.java:681)

at android.hardware.camera2.legacy.GLThreadManager$1.handleMessage(GLThreadManager.java:103)

at android.os.Handler.dispatchMessage(Handler.java:98)

at android.os.Looper.loop(Looper.java:135)

at android.os.HandlerThread.run(HandlerThread.java:61)

Any Idea what I am doing wrong. I spent few hours but couldn't find any solution.

Edit - I am using geneymotion emulator. The path I am using

file /storage/emulated/0/Android/data/com.gold.cameratwoapi/files/video.mp4

Thanks

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值