Example usage for android.provider MediaStore ACTION_VIDEO_CAPTURE

List of usage examples for android.provider MediaStore ACTION_VIDEO_CAPTURE

Introduction

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

Prototype

String ACTION_VIDEO_CAPTURE

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

Click Source Link

Document

Standard Intent action that can be sent to have the camera application capture a video and return it.

Usage

From source file:khoa.p.le.innerview.MainActivity.java

private void dispatchTakeVideoIntent() {
    Intent takeVideoIntent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
    if (takeVideoIntent.resolveActivity(getPackageManager()) != null) {
        startActivityForResult(takeVideoIntent, REQUEST_VIDEO_CAPTURE);
    }/* w  w  w.j  a v a2 s  . c  om*/
}

From source file:com.kbeanie.imagechooser.api.VideoChooserManager.java

private String captureVideoPatchedMethodForGingerbread() throws ChooserException {
    try {/*from w w w .ja v  a 2 s .  c  o m*/
        Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
        if (extras != null) {
            intent.putExtras(extras);
        }
        startActivity(intent);
    } catch (ActivityNotFoundException e) {
        throw new ChooserException(e);
    }
    return null;
}

From source file:com.cars.manager.utils.imageChooser.api.VideoChooserManager.java

private String captureVideoPatchedMethodForGingerbread() throws Exception {
    try {//from   w  w w .j  a  v a 2s .  co m
        Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
        startActivity(intent);
    } catch (ActivityNotFoundException e) {
        throw new Exception("Activity not found");
    }
    return null;
}

From source file:com.amytech.android.library.views.imagechooser.api.VideoChooserManager.java

private String captureVideoPatchedMethodForGingerbread() throws Exception {
    try {/* w w  w  .  j  a v a 2 s  . c o m*/
        Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
        if (extras != null) {
            intent.putExtras(extras);
        }
        startActivity(intent);
    } catch (ActivityNotFoundException e) {
        throw new Exception("Activity not found");
    }
    return null;
}

From source file:com.cw.litenote.note_add.Note_addCameraVideo.java

private void takeVideoWithName() {
    Intent takeVideoIntent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);

    // Ensure that there's a camera activity to handle the intent
    if (takeVideoIntent.resolveActivity(getPackageManager()) != null) {
        // Create temporary image File where the photo will save in
        File tempFile = null;/*from   w ww  . j  a  v  a 2 s  . c  o m*/
        try {
            tempFile = createTempVideoFile();
        } catch (IOException ex) {
            // Error occurred while creating the File
        }

        // Continue only if the File was successfully created
        if (tempFile != null) {
            videoUri = Uri.fromFile(tempFile); // so far, file size is 0
            takeVideoIntent.putExtra(MediaStore.EXTRA_OUTPUT, videoUri); // appoint Uri for captured image
            videoUriInDB = videoUri.toString();
            startActivityForResult(takeVideoIntent, TAKE_VIDEO_ACT);
        }
    }
}

From source file:ca.taglab.PictureFrame.ScreenSlidePageFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    // Inflate the layout containing a title and body text.
    final ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.fragment_screen_slide_page, container,
            false);//from w  ww .j  av a 2s.  c  o m

    Bitmap picture = BitmapFactory.decodeFile(mImgPath);
    rootView.setBackground(new BitmapDrawable(getResources(), picture));

    mConfirmation = (ImageView) rootView.findViewById(R.id.confirm);

    ((TextView) rootView.findViewById(R.id.name)).setText(mName);
    rootView.findViewById(R.id.control).getBackground().setAlpha(200);

    optionsOpen = false;

    mMsgHistory = rootView.findViewById(R.id.msg);
    mMsgHistory.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(getActivity(), MessagesActivity.class);
            intent.putExtra("user_name", mName);
            intent.putExtra("user_id", mId);
            intent.putExtra("owner_id", mOwnerId);
            startActivity(intent);
            hideOptions();
        }
    });

    mPhoto = rootView.findViewById(R.id.photo);
    mPhoto.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            try {
                String filename = String.valueOf(System.currentTimeMillis()) + ".jpg";
                ContentValues values = new ContentValues();
                values.put(MediaStore.Images.Media.TITLE, filename);
                mCapturedImageURI = getActivity().getContentResolver()
                        .insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);

                Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
                intent.putExtra(MediaStore.EXTRA_OUTPUT, mCapturedImageURI);
                startActivityForResult(intent, CAPTURE_PICTURE);
                hideOptions();
            } catch (Exception e) {
                Log.e(TAG, "Camera intent failed");
            }
        }
    });

    mVideo = rootView.findViewById(R.id.video);
    mVideo.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            try {
                String filename = String.valueOf(System.currentTimeMillis()) + ".3gp";
                ContentValues values = new ContentValues();
                values.put(MediaStore.Video.Media.TITLE, filename);
                mCapturedVideoURI = getActivity().getContentResolver()
                        .insert(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, values);

                Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
                intent.putExtra(MediaStore.EXTRA_OUTPUT, mCapturedVideoURI);
                startActivityForResult(intent, CAPTURE_VIDEO);
                hideOptions();
            } catch (Exception e) {
                Log.e(TAG, "Video intent failed");
            }
        }
    });

    mAudio = rootView.findViewById(R.id.audio);
    mAudio.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            try {
                Intent intent = new Intent(getActivity(), AudioRecorderActivity.class);
                startActivityForResult(intent, CAPTURE_AUDIO);
                hideOptions();
            } catch (Exception e) {
                Log.e(TAG, "Audio intent failed");
            }
        }
    });

    mWave = rootView.findViewById(R.id.wave);
    mWave.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            try {
                new SendEmailAsyncTask(getActivity(), mEmail, "PictureFrame: I'm thinking of you",
                        "Wave sent via PictureFrame", null).execute();
                //Toast.makeText(getActivity(), "Wave sent to: " + mEmail, Toast.LENGTH_SHORT).show();
                hideOptions();
                messageSent(v);
            } catch (Exception e) {
                Log.e("SendEmailAsyncTask", e.getMessage(), e);
                //Toast.makeText(getActivity(), "Wave to " + mEmail + " failed", Toast.LENGTH_SHORT).show();
            }
        }
    });

    mCancel = rootView.findViewById(R.id.close);

    mPhoto.getBackground().setAlpha(200);
    mVideo.getBackground().setAlpha(200);
    mAudio.getBackground().setAlpha(200);
    mWave.getBackground().setAlpha(200);

    mShortAnimationDuration = getResources().getInteger(android.R.integer.config_shortAnimTime);
    mLongAnimationDuration = getResources().getInteger(android.R.integer.config_longAnimTime);

    rootView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (!optionsOpen)
                showOptions();
        }
    });

    mCancel.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (optionsOpen)
                hideOptions();
        }
    });

    Cursor unread = getActivity().getContentResolver().query(UserContentProvider.MESSAGE_CONTENT_URI,
            MessageTable.PROJECTION,
            MessageTable.COL_TO_ID + "=? AND " + MessageTable.COL_FROM_ID + "=? AND " + MessageTable.COL_READ
                    + "=?",
            new String[] { Long.toString(mOwnerId), Long.toString(mId), Long.toString(0) }, null);
    if (unread != null && unread.moveToFirst()) {
        rootView.findViewById(R.id.notification).setVisibility(View.VISIBLE);
        rootView.findViewById(R.id.notification).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(getActivity(), MessagesActivity.class);
                intent.putExtra("user_name", mName);
                intent.putExtra("user_id", mId);
                intent.putExtra("owner_id", mOwnerId);
                startActivity(intent);
                v.setVisibility(View.INVISIBLE);
            }
        });
    }
    if (unread != null) {
        unread.close();
    }

    return rootView;
}

From source file:com.chute.android.photopickerplus.ui.activity.ServicesActivity.java

@Override
public void recordVideo() {
    Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
    Uri uri = AppUtil.getTempVideoFile();
    if (uri != null) {
        intent.putExtra(MediaStore.EXTRA_OUTPUT, uri);
    }//from w ww  .  j a  va2  s.  com
    intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1);
    startActivityForResult(intent, Constants.CAMERA_VIDEO_REQUEST);

}

From source file:com.android.browser.UploadHandler.java

private Intent createCamcorderIntent() {
    return new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
}

From source file:com.liferay.mobile.screens.viewsets.defaultviews.ddl.form.fields.DDLDocumentFieldView.java

@NonNull
private Action1<Boolean> launchCamera(final String intent) {
    return new Action1<Boolean>() {
        @Override// www  .  ja v  a2s .c o  m
        public void call(Boolean result) {
            if (result) {
                Intent cameraIntent = new Intent(intent);
                File file = MediaStore.ACTION_VIDEO_CAPTURE.equals(intent) ? FileUtil.createVideoFile()
                        : FileUtil.createImageFile();

                if (file != null) {
                    getField().createLocalFile(file.getAbsolutePath());
                    Uri photoURI = FileProvider.getUriForFile(getContext(),
                            getContext().getPackageName() + ".screensfileprovider", file);
                    cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI);

                    Activity activity = LiferayScreensContext.getActivityFromContext(getContext());
                    activity.startActivityForResult(cameraIntent, positionInForm);
                }
            }
            choseOriginDialog.dismiss();
        }
    };
}

From source file:com.android.camera.v2.uimanager.ThumbnailManager.java

/**
 * Create a thumbnail manager controller.
 * @param appcontroller controller used to get service for storage.
 * @param activity the current activity.
 * @param parent view group./*from  w w  w  .j  a  v  a  2 s. c  o  m*/
 * @param secureCamera whether the current camera is secure camera or not.
 */
public ThumbnailManager(AppController appcontroller, Activity activity, ViewGroup parent,
        boolean secureCamera) {
    super(activity, parent);
    mIsSecureCamera = secureCamera;
    setFilterEnable(false);
    mStorageService = appcontroller.getAppControllerAdapter().getServices().getStorageService();
    mActivity = activity;
    mContentResolver = activity.getContentResolver();
    mMaiHandler = new Handler(activity.getMainLooper());
    HandlerThread t = new HandlerThread("thumbnail-creation-thread");
    t.start();
    mHandler = new ThumbnailCreatorHandler(t.getLooper());
    mThumbnailAnimation = new ThumbnailAnimation();

    LocalBroadcastManager manager = LocalBroadcastManager.getInstance(mActivity);
    manager.registerReceiver(mUpdatePictureReceiver, mUpdatePictureFilter);
    mActivity.registerReceiver(mIpoShutdownReceiver, mIpoShutdownFilter);

    mIntent = activity.getIntent();
    String action = null;
    if (mIntent != null) {
        action = mIntent.getAction();
    }
    if (MediaStore.ACTION_IMAGE_CAPTURE.equals(action) || MediaStore.ACTION_VIDEO_CAPTURE.equals(action)
            || CameraUtil.ACTION_STEREO3D.equals(action)) {
        mShownByIntent = false;
    }
}