我正在努力将Camera2 api集成到我的应用程序中。当我从纵向模式切换到横向时,它会抛出异常
<div class="wrapper">
<span class="button">Star</span>
<div class="popup">
<p>Option 1</p>
<p>Option 2</p>
<p>Option 3</p>
<p>Option 4</p>
<p>Option 5</p>
<p>Option 6</p>
<p>Option 7</p>
<p>Option 8</p>
<p>Option 9</p>
</div>
</div>
答案 0 :(得分:2)
我遇到了类似的问题,这对我有所帮助。如果您一直在参考Sample app,则应通过重写onClosed(CameraDevice)方法来停止CameraDevice.StateCallback中的线程:
mCameraDevice.createCaptureSession(outputSurfaces,
new CameraCaptureSession.StateCallback() {
@Override
public void onClosed(@NonNull CameraCaptureSession session) {
super.onClosed(session);
stopBackgroundThread();
}
答案 1 :(得分:0)
在我的情况下,此错误之前是
2020-12-15 18:31:55.703 5079-5079/com.android.example.camera2.video W/CameraDevice-JV-0: Stream configuration failed due to: createStream:1008: Camera 0: Surface already has a stream created for it (ID 0)
2020-12-15 18:31:55.704 5079-5079/com.android.example.camera2.video E/CameraCaptureSession: Session 0: Failed to create capture session; configuration failed
问题是我将曲面添加到列表中并将其添加为目标,但没有清除它。
我也是setRepeatingRequest
之前updateRepeatingRequest
的{{1}}
清除override fun onConfigured(s: CameraCaptureSession) {
中的曲面并删除其他的updateRepeatingRequest对其进行了修复。