How to use SiliCompressor to compress videos and image?

Viewed 1126

Hi I am a new android developer working on a project that involves uploading images and videos. I need to compress files and I've seen the library SiliCompressor but the documentation and other explanations is too vague for me. Can you tell me how to use it? But in an easy to understand way. Thanks!

1 Answers
private class CompressVideo extends AsyncTask<String,String,String> {
    Dialog dialog;

    @Override
    protected void onPreExecute() {
        super.onPreExecute();

        dialog = ProgressDialog.show(AddPostActivity.this, "", "Compressing...");
    }

    @Override
    protected String doInBackground(String... strings) {
        String videoPath = null;
        try {
         Uri uri = Uri.parse(strings[1]);

         videoPath = SiliCompressor.with(AddPostActivity.this)
                 .compressVideo(uri,strings[2]);
        } catch (URISyntaxException e) {
            e.printStackTrace();
        }


        return videoPath;
    }
Related