SiliCompressor库无法正常工作

时间:2018-03-22 19:16:13

标签: android video compression

我使用SiliCompressor library并且我在结果中大部分只获得了611个确切字节,显然压缩在任何情况下都不起作用。我的代码有问题吗?

new AsyncTask<Void, Void, Uri>() {

        @Override
        protected Uri doInBackground(Void... voids) {
            Uri newFileUri = null;
            try {
                File f = getDir("Videos", Context.MODE_PRIVATE); //Creating an internal dir;
                if (f.mkdirs() || f.isDirectory()) {
                    //compress and output new video specs
                    String filePath = SiliCompressor.with(UploadPostActivity.this).compressVideo(mVideoUri, f.getPath());
                    newFileUri = Uri.fromFile(new File(filePath));
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
            return newFileUri;
        }
        @Override
        protected void onPostExecute(Uri videoUri) {
            super.onPostExecute(videoUri);
            mVideoView.setVideoURI(videoUri);
        }
    }.execute();

0 个答案:

没有答案