录制的视频无法立即从文件位置读取?

Recorded video Can't read from the file Location Instantly?

我正在使用我的 android 录制视频 application.when 我试图在录制后从路径中读取视频 我没有得到完整的录制文件。 但一段时间后我可以阅读完整内容 file.i 不知道是什么问题? 请帮忙。 这是我的代码

尝试{ videoFile = getOutputMediaFile(MEDIA_TYPE_VIDEO); videothumb = new File(getOutputMediaThumbFile(MEDIA_TYPE_VIDEO), videoFile.getName()); db.insertFileInfo(videoFile.getName(), 0, videoFile.length(), 0, "video/mp4"); 如果(videoFile == null){ Log.d("", "Error creating media file, check storage permissions: "); safeToTakePicture = true; return空; }

            videothumb.createNewFile();
            videoFile.createNewFile();
            Thread.sleep(10000);
            upVFile = new File(videoFile.getAbsolutePath());
            FileOutputStream fos = new FileOutputStream(videoFile);
            FileOutputStream ftos = new FileOutputStream(videothumb);
            thumb = Bitmap.createScaledBitmap(bmv, 200, 200, false);
            thumb.compress(Bitmap.CompressFormat.JPEG, 90, ftos);
            ftos.flush();
            ftos.close();
            bmv.compress(Bitmap.CompressFormat.JPEG, 100, fos);
            fos.flush();
            fos.close();
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            bmv.compress(Bitmap.CompressFormat.JPEG, 100, baos);
            byte[] b = baos.toByteArray();
            baos.close();
            String encodedImage = new String(Base64.encodeBase64(b));
            editor.putString("image_data", encodedImage);
            editor.commit();
            editor.putString(IMAGE_NAME, videoFile.getName());
            editor.commit();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
        }

写一个刷新图库的方法

private void refreshGallery(File file){

Intent mediaScanIntent=new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);

mediaScanIntent.setData(Uri.fromFile(file));

sendBroadcast(mediaScanIntent);

}