Comments (2)
Having the same issue. Solving it in the following way:
Note
This is not exactly how I use it. I'm using a class where I have a stream controller and a completer where the completer is completed once compression is finished, and the stream gets continuous progress updates.
int? percentage = 0;
final subscription =
vc.VideoCompress.compressProgress$.subscribe((progress) {
percentage = progress.toInt();
});
final vc.MediaInfo? mediaInfo = await vc.VideoCompress.compressVideo(
file.path,
includeAudio: true,
);
subscription.unsubscribe();
canceled = false;
failed = false;
File? compressedFile;
if (mediaInfo != null && mediaInfo.file != null) {
if (mediaInfo.isCancel == true) {
canceled = true;
} else {
compressedFile = mediaInfo.file!;
percentage = 100;
}
} else {
failed = true;
}
from videocompress.
For a workaround, see #259 (comment).
Issue:
This line seems to be the issue:
The timer that updates the progress every
0.1
seconds may be invalidated before the 100% progress can be propagated.
Proposal:
I'd suggest invalidating the timer inside the updateProgress
func once the progress has reached 100% or stopCommand
is true
:
@objc private func updateProgress(timer: Timer) {
let asset = timer.userInfo as! AVAssetExportSession
guard !stopCommand && asset.progress < 1.0 else {
timer.invalidate()
return
}
channel.invokeMethod("updateProgress", arguments: "\(String(describing: asset.progress * 100))")
}
from videocompress.
Related Issues (20)
- java.lang.IllegalArgumentException: could not access /data/user/0/com.example.test_compress/app_flutter/Trimmer/VID_20230725_163032_446_trimmed:Aug4,2023-17:32:10.mp4 HOT 1
- Could not find com.otaliastudios:transcoder:0.9.1 HOT 13
- Work with isolate
- Missing link to repo in pub.dev
- Add support for dart native HOT 1
- compression cancel
- Please add more compression options
- Support for Windows/Linux
- Plans for Implementing Privacy Manifest Support?
- Inconsistent JVM-target compatibility detected for tasks 'compileDebugJavaWithJavac' (1.8) and 'compileDebugKotlin' (17). HOT 7
- Fatal error while transcoding, this might be invalid format or bug in engine or Android. VideoCompress HOT 1
- MissingPluginException(No implementation found for method setLogLevel on channel video_compress) HOT 4
- Android issue
- Could not create an instance of type com.android.build.api.variant.impl.LibraryVariantBuilderImpl. HOT 4
- FAILURE: Build failed with an exception. HOT 1
- New Release? HOT 5
- VideoQuality.Res1920x1080Quality seems not work properly.
- Remove references to deprecated v1 Android embedding
- Failed to ensure /storage/0820-0C0C/Android/data/com.xxx.xxx/files/video_compress: android.os.ServiceSpecificException: (code -22)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from videocompress.