Android MediaStore insertVideo

后端 未结 5 689
予麋鹿
予麋鹿 2020-11-30 09:46

So our app has the option to take either a picture or a video. If the user takes a picture, we can use the MediaStore.Images.Media.insertImage function to add the new image

5条回答
  •  暖寄归人
    2020-11-30 10:00

    Try this code. It seems working for me.

     filePath = myfile.getAbsolutePath();
     ContentValues values = new ContentValues();
     values.put(MediaStore.Video.Media.DATA, filePath);
     return context.getContentResolver().insert(
                        MediaStore.Video.Media.EXTERNAL_CONTENT_URI, values);
    

    Example of filePath -

    /storage/emulated/0/DCIM/Camera/VID_20140313_114321.mp4
    

提交回复
热议问题