androidcommonsware-cwaccwac-camera

Video Previewing in CWAC-CAMERA


In the CWAC-CAMERA DOCUMENT it is written "From a UI standpoint, the CameraFragment solely handles the preview pane.".But for videos i don't see any preview is avalaible after i capture video.Do CWAC-CAMERA library has inbuilt video previewing?Below is code i am using.

 f = new CameraFragment();
        getFragmentManager().beginTransaction()
                .add(R.id.preview_view, f, TAG_CAMERA_FRAGMENT)
                .commit();
builder=new SimpleCameraHost.Builder(new DemoCameraHost(getApplicationContext()));
switchToVideoOpen.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View view) {
  if (!isVideoOpen) {

    isVideoOpen = true;


    takeVideo();
}
else{
    isVideoOpen = false;

    stopVideo();
}


    }
});
private void takeVideo() {

    CameraFragment f = (CameraFragment) getFragmentManager().findFragmentByTag(TAG_CAMERA_FRAGMENT);
    if (f != null && f.isVisible()) {
        try {
            f.record();


        } catch (Exception e) {

        }
    }
}
private void stopVideo() {

    CameraFragment f = (CameraFragment) getFragmentManager().findFragmentByTag(TAG_CAMERA_FRAGMENT);
    if (f != null && f.isVisible()) {
        try {
            f.stopRecording();


        } catch (Exception e) {

        }
    }
}

Solution

  • Previews are what the user sees while lining up the photo or video to be captured.

    But for videos i don't see any preview is avalaible after i capture video

    You can call that whatever you want, but I will not be calling it a "preview". CWAC-Camera does not display photos or videos after they are taken. If you want to do that, you need to do that yourself.