title: How to add target to Camera Capture Session after it's started?
body: <p>I'm attempting to add a new target to my camera2 capture session after the capture session has already been created and configured.</p>
  <p>My goal is to be able to have a smooth recording using a media codec with the ability to toggle a preview on and off (without toggling the texture view as visible/invisible).</p>
  <p>Currently, I have been able to add or remove targets by switching between/creating different capture sessions, however, this results in small freezes in the recordings when I open/close the preview activity/capture sessions, which I need to eliminate.</p>
  <p>After scouring the internet I haven't found any other way to add targets other than creating a new capture session, which the capture session documentation itself says is &quot;expensive&quot; and can take &quot;several hundred milliseconds&quot;.</p>
  <blockquote>
  <p>Creating a session is an expensive operation and can take several hundred milliseconds, since it requires configuring the camera device's internal pipelines and allocating memory buffers for sending images to the desired targets.&lt;</p>
  </blockquote>
  <p><a href="https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession" rel="nofollow noreferrer">https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession</a></p>
  <p>Is this the only way? Or am I just missing something? Thanks in advance!</p>