RudreshJR / VideoCompression

Library for VideoCompression
111 stars 45 forks source link

No Information about usage #3

Closed mbernr closed 6 years ago

mbernr commented 7 years ago

The readme contains no information about how to use this library.

larrytech7 commented 7 years ago

And i feel it's really frustrating. who goes around writing a library without documentation. It's incomplete work to the core. Please bring up a documentation if you are still passionate about this library. We are counting on it.,

rasik1010 commented 7 years ago

You just have to import all the classes, except MainActivity and import the JAR files to your main project and use "MediaController.getInstance().convertVideo(path)" this will compress your video and you can get the path of compressed video from here "MediaController.cachedFile.getPath()"

I know documentation is not given, however if you see the project its very crystal clear and simple to understand.

Happy Coding :)

larrytech7 commented 7 years ago

Please what is the format for the path of the video to be converted? i'm having trouble as it keeps giving my illegalargument errors for the path

2017-05-19 12:08 GMT+01:00 rasik1010 notifications@github.com:

You just have to import all the classes, except MainActivity and import the JAR files to your main project and use "MediaController.getInstance().convertVideo(path)" this will compress your video and you can get the path of compressed video from here "MediaController.cachedFile.getPath()"

I know documentation is not given, however if you see the project its very crystal clear and simple to understand.

Happy Coding :)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/RudreshJR/VideoCompression/issues/3#issuecomment-302675295, or mute the thread https://github.com/notifications/unsubscribe-auth/AGMQfWMwv6BuDBhS7CmAZBKantop56-2ks5r7XgrgaJpZM4NAEx9 .

-- Akah Larry N.H

Android Engineer, Co-Founder @Traveler Founder @IceTeck www.traveler.cm

Developing technologies for emergence and sustainable development.

rasik1010 commented 7 years ago

String path; Uri captureVideoUri;

File root = new File(Capture_ImagePath); if (!root.exists()) { System.out.println("No directory"); root.mkdirs(); } File file; file = new File(root, +System.currentTimeMillis() + ".mp4");

    captureVideoUri = Uri.fromFile(file);

    Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
    intent.putExtra(MediaStore.EXTRA_OUTPUT, captureVideoUri);
    startActivityForResult(intent, REQUEST_VIDEO);

==============================

if (_requestCode == REQUEST_VIDEO && resultCode == Activity.RESULT_OK) { path = captureVideoUri.getPath(); new VideoCompressor().execute(); }

===============================

class VideoCompressor extends AsyncTask<Void, Void, Boolean> {

    @Override
    protected void onPreExecute() {
        super.onPreExecute();
        LogUtils.e("OnPreExecute", "OnPreExecute");
    }

    @Override
    protected Boolean doInBackground(Void... params) {
        LogUtils.e("doInBackground", "doInBackground");
        return MediaController.getInstance().convertVideo(path);
    }

    @Override
    protected void onPostExecute(Boolean compressed) {
        super.onPostExecute(compressed);
        stopProgressDialog();
        if (compressed) {
            LogUtils.e("Compression", "Compression successfully!");
            LogUtils.e("Compressed File Path", "" + MediaController.cachedFile.getPath());
            addImageToGridView(MediaController.cachedFile.getPath(), MediaItem.VIDEO, bitmap);
        }

    }
}
iceteck commented 7 years ago

Hey Larry, maybe put a space between the '@' symbol and your company names in your signature please? You keep accidently mentioning me..

larrytech7 commented 7 years ago

I think i have figured that out, made a few modifications and packaged this as a library to be published for android devs on jcenter soon.