Skip to content

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

Description

@tirrorex

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions