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

Setting progress makes the overlay appear only when progress = 1 #134

Open
tirrorex opened this issue Feb 1, 2017 · 0 comments
Open

Setting progress makes the overlay appear only when progress = 1 #134

tirrorex opened this issue Feb 1, 2017 · 0 comments

Comments

@tirrorex
Copy link

tirrorex commented Feb 1, 2017

Hello, trying to use MRProgress with AVAssetExportSession in swift 2.2
I want to display the overlay according the the session.progress value (going from 0 to 1).
It seems however that setting the progress to the overlay does nothing until the value is equal to 1.
If i did something wrong in my code could someone point me to the good direction?
Here is the related code :

if let exportSession = AVAssetExportSession(asset: urlAsset, presetName: Config.VIDEO_COMPRESSION_PRESET) {
exportSession.outputURL = outputURL
exportSession.outputFileType = AVFileTypeMPEG4
exportSession.shouldOptimizeForNetworkUse = true
exportSession.timeRange = CMTimeRangeMake(kCMTimeZero, urlAsset.duration)

        exportSession.exportAsynchronouslyWithCompletionHandler { () -> Void in
            handler(session: exportSession)
        }
        dispatch_async(dispatch_get_main_queue(), { () -> Void in
            let overlayView = MRProgressOverlayView.showOverlayAddedTo(self.view, title: "Preparing", mode: .DeterminateCircular, animated: true)
            while exportSession.status == .Waiting || exportSession.status == .Exporting {
                print("Progress: \(exportSession.progress * 100.0)%., progress \(exportSession.progress)")
                overlayView.setProgress(exportSession.progress, animated: true)
            }
            overlayView.dismiss(true)
        })
    }

output example from my print :
Progress: 2.62599%., progress 0.0285576

Or it can be due to the animation delay for the overlay to appear, not sure about that.

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

1 participant