1

Bir videoyu android uygulamamı kullanarak kaydediyorum.Kayıtından sonra videodan okumaya çalıştığım zaman kaydedilen kayıt dosyasını tam olarak kaydetmedim. ama bir süre sonra tam dosyayı okuyabilirim. Sorun nedir? lütfen yardım edin. İşte kodumKayıtlı video Anında Konumdan dosya okunamıyor mu?

{ videoFile = getOutputMediaFile (MEDIA_TYPE_VIDEO); videothumb = new Dosya (getOutputMediaThumbFile (MEDIA_TYPE_VIDEO), videoFile.getName()); db.insertFileInfo (videoFile.getName(), 0, videoFile.length(), 0, "video/mp4"); if (videoFile == null) { Log.d ("", "Medya dosyası oluşturulurken hata oluştu, depolama izinlerini kontrol edin:"); safeToTakePicture = true; dönüş null; }

  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 { 
     } 

cevap

1

galerisi

private void refreshGallery(File file){ 

Intent mediaScanIntent=new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE); 

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

sendBroadcast(mediaScanIntent); 

} 
ferahlatıcı bir metod yazmasını
İlgili konular