Java Code Examples for android.provider.MediaStore#INTENT_ACTION_VIDEO_CAMERA

The following examples show how to use android.provider.MediaStore#INTENT_ACTION_VIDEO_CAMERA . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CameraStartUp.java    From Camera2 with Apache License 2.0 6 votes vote down vote up
private long launchVideo()
{
    long startupTime = 0;

    try
    {
        Intent intent = new Intent(MediaStore.INTENT_ACTION_VIDEO_CAMERA);
        intent.setClass(getInstrumentation().getTargetContext(), CameraActivity.class);
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        long beforeStart = System.currentTimeMillis();
        Instrumentation inst = getInstrumentation();
        Activity recorderActivity = inst.startActivitySync(intent);
        long cameraStarted = System.currentTimeMillis();
        recorderActivity.finish();
        startupTime = cameraStarted - beforeStart;
        Log.v(TAG, "Video Startup Time = " + startupTime);
        // wait for 1s to make sure it reach a clean stage
        Thread.sleep(WAIT_TIME_FOR_PREVIEW);
        Log.v(TAG, "video startup time: " + startupTime);
    } catch (Exception e)
    {
        Log.v(TAG, "Got exception", e);
        fail("Fails to launch video output file");
    }
    return startupTime;
}
 
Example 2
Source File: VideoCapture.java    From Camera2 with Apache License 2.0 5 votes vote down vote up
public void testBackVideoCapture() throws Exception
{
    Instrumentation inst = getInstrumentation();
    Intent intent = new Intent(MediaStore.INTENT_ACTION_VIDEO_CAMERA);

    intent.setClass(getInstrumentation().getTargetContext(), CameraActivity.class);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.putExtra(EXTRAS_CAMERA_FACING,
            android.hardware.Camera.CameraInfo.CAMERA_FACING_BACK);
    Activity act = inst.startActivitySync(intent);
    Thread.sleep(WAIT_FOR_SWITCH_CAMERA);
    captureVideos("Back Camera Video Capture\n", inst);
    act.finish();
}
 
Example 3
Source File: VideoCapture.java    From Camera2 with Apache License 2.0 5 votes vote down vote up
public void testFrontVideoCapture() throws Exception
{
    Instrumentation inst = getInstrumentation();
    Intent intent = new Intent(MediaStore.INTENT_ACTION_VIDEO_CAMERA);

    intent.setClass(getInstrumentation().getTargetContext(), CameraActivity.class);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.putExtra(EXTRAS_CAMERA_FACING,
            android.hardware.Camera.CameraInfo.CAMERA_FACING_FRONT);
    Activity act = inst.startActivitySync(intent);
    Thread.sleep(WAIT_FOR_SWITCH_CAMERA);
    captureVideos("Front Camera Video Capture\n", inst);
    act.finish();
}