flutter_video_compress
Compressed video generates a new path, keep the source video or delete it. provide get video information or get thumbnail of the video file.
Before Android installation
If your program not enabled
AndroidX
, you will need to add the following code to the last line of the android/build.gradle
file.Before IOS installation
If your program not support swift, you need to add the following code in
ios/Podfile
.detailMethods
FUNCTION | PARAMETER | DESCRIPTION | RETURN |
---|---|---|---|
getThumbnail | String [path] , int [quality] (1-100), int [position] | get thumbnail from [path] | [Future<Uint8List>] |
getThumbnailWithFile | String [path] , int [quality] (1-100), int [position] | get thumbnail file from [path] | [Future<File>] |
convertVideoToGif | String [path] , int [startTime] (from 0 start), int [endTime] , int [duration] | converts provided video to a gif | [Future<File>] |
getMediaInfo | String [path] | get media information from [path] | [Future<MediaInfo>] |
compressVideo | String [path] , VideoQuality [quality] , bool [deleteOrigin] , int [startTime] , int [duration] , bool [includeAudio] , bool [frameRate] | compress video at [path] | [Future<MediaInfo>] |
cancelCompression | [none] | stop compressing the file that is currently being compressed. | [Future<void>] |
deleteAllCache | [none] | Delete the cache, please do not put other things in the folder of this plugin, it will be cleared | [Future<bool>] |
Subscriptions
SUBSCRIPTION | DESCRIPTION | STREAM |
---|---|---|
compressProgress$ | Subscribe the conversion progress steam | double [progress] |
Usage
Creating instance.
Get thumbnail by video file
Get thumbnail file by video file
Converts provided video to a gif.
Get media information
Currently only supports video
Compression Video
Compatible with ios in Android and web after compression
Check Compressing state
Stop compression
Android will print InterruptedException, but does not affect the use
delete all cache file
Delete all the files generated by this plugin, I think you ought to know what you are doing.
Subscribe the conversion progress steam
Notice
If you find that the size of the apk is significantly increased after importing the plugin, it may be due to the following reasons:
- exclude
x86
related files (./assets
) - This library does not use
ffprobe
, only usesffmpeg
, but the application still hasffprobe
, so it needs to be excluded (asssets/arm
orassets/x86
)
add this config in
build.gradle
:- Do not use
ignoreAssetsPattern "!x86"
in debug mode, will crash on the simulator