利用 MediaStore.ACTION_VIDEO_CAPTURE得到返回路径

2017-04-13 0 条评论 478 次阅读 1 人点赞

启动:

  Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
        intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1);
        Log.d(TAG, "click() called "+Utils.PATH);
        intent.putExtra(MediaStore.EXTRA_OUTPUT,Utils.PATH);
        intent.putExtra(android.provider.MediaStore.EXTRA_DURATION_LIMIT, 120000);
        startActivityForResult(intent, 111);

返回 onActivityResult:

if (data.getData() != null && "content".equals(data.getData().getScheme())) {
                Cursor cursor = this
                        .getContentResolver()
                        .query(data.getData(),
                                new String[] { android.provider.MediaStore.Video.VideoColumns.DATA },
                                null, null, null);
                cursor.moveToFirst();
                Log.d(TAG, "onActivityResult: "+cursor.getString(0));
                cursor.close();

TestSmirk

这个人太懒什么东西都没留下

文章评论(0)