我正在尝试压缩项目中的视频,因此使用 silicompressor。但是当我将它传递给我的应用程序的目标路径时,它会挂起并且什么也不做。但它确实在我的存储中创建了一个文件夹并存储了一个视频文件,但是当我尝试播放它时,它给出了错误“无法播放视频”。该文件的大小为 24 字节。所以看看,告诉我做错了什么。
这是我的代码。
File destinationPath = new File("/storage/emulated/0/DCIM/Camera/myvideo");
destinationPath.mkdir();
File file = new File(destinationPath.getAbsolutePath());
Toast.makeText(Post.this, "folder: " + file, Toast.LENGTH_SHORT).show();
try {
filePath = SiliCompressor.with(Post.this).compressVideo(videouri, file.toString());
video.setVideoURI(Uri.parse(filePath));
Toast.makeText(Post.this, "Completed", Toast.LENGTH_SHORT).show();
} catch (URISyntaxException e) {
Log.d("EXCEPTION", e.toString());
Toast.makeText(Post.this, e.getMessage(), Toast.LENGTH_SHORT).show();
e.printStackTrace();
}