package com.xty.common.picture
import com.vincent.videocompressor.VideoCompress
import com.vincent.videocompressor.VideoCompress.CompressListener
/**
 * 视频压缩
 */

class VideoCompressUtils(var success:(compressPath:String)->Unit,var fail:()->Unit) {

    /**
     * 视频原地址
     * 压缩后的地址
     *
     */
    fun compress(path:String,destPath:String){
        VideoCompress.compressVideoLow(path, destPath,
            object : CompressListener {
                override fun onStart() {
                    //Start Compress
                }

                override fun onSuccess() {
                    //Finish successfully
                    success.invoke(destPath )
                }

                override fun onFail() {
                    //Failed
                    fail.invoke()
                }

                override fun onProgress(percent: Float) {
                    //Progress
                }
            })

    }


}