Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compression progress never getting to 100 on iOS #259

Open
notsag-dev opened this issue Feb 27, 2024 · 3 comments
Open

Compression progress never getting to 100 on iOS #259

notsag-dev opened this issue Feb 27, 2024 · 3 comments

Comments

@notsag-dev
Copy link

I'm subscribing to the progress of the compression to give visual feedback to the user. On Android the progress goes until a 100 but for iOS it seems to stop right before getting to 100, it seems it just misses the last event because it gets super close. Anyone else seeing this issue?

Thanks.

@marvin-kolja

This comment was marked as off-topic.

@marvin-kolja
Copy link

marvin-kolja commented Jul 4, 2024

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))")
}

@jpetro416
Copy link

Any update on if this fix will be implemented into 3.1.4?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants