Example usage for android.provider MediaStore EXTRA_FINISH_ON_COMPLETION

List of usage examples for android.provider MediaStore EXTRA_FINISH_ON_COMPLETION

Introduction

In this page you can find the example usage for android.provider MediaStore EXTRA_FINISH_ON_COMPLETION.

Prototype

String EXTRA_FINISH_ON_COMPLETION

To view the source code for android.provider MediaStore EXTRA_FINISH_ON_COMPLETION.

Click Source Link

Document

The name of the Intent-extra used to control the onCompletion behavior of a MovieView.

Usage

From source file:com.sandklef.coachapp.fragments.TrainingPhasesFragment.java

@Override
public boolean onContextItemSelected(MenuItem item) {
    AdapterView.AdapterContextMenuInfo acmi = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
    int position = acmi.position;

    String fileName = LocalStorage.getInstance().getNewMediaDir() + "/tp-" + currentTPId
            + JsonSettings.SERVER_VIDEO_SUFFIX;
    Media m = Media.newInstructionVideo(fileName, currentTPId);
    currentTPId = null;/* ww  w  .j  a v a  2 s.c o m*/
    Uri uri = Uri.fromFile(new File(fileName));

    if (m != null) {
        Log.d(LOG_TAG, "   instruction video item: " + fileName);
        Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);

        Log.d(LOG_TAG, "  file: " + fileName + " uri: " + uri);

        intent.putExtra(MediaStore.EXTRA_OUTPUT, uri);
        intent.putExtra("android.intent.extra.durationLimit", 5);
        intent.putExtra(MediaStore.EXTRA_FINISH_ON_COMPLETION, true);
        intent.putExtra(MediaStore.EXTRA_DURATION_LIMIT, 5);
        intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1); // set the video image quality to high
        // start the image capture Intent
        //context.startActivity(intent);
        //            activity.startActivityForResult(intent, com.sandklef.coachapp.fragments.VideoCapture.VIDEO_CAPTURE);
        ((Activity) getContext()).startActivityForResult(intent, VIDEO_CAPTURE);
    }
    Log.d(LOG_TAG, "  new instruction video wanted creation: " + fileName);

    return true;
}