Edit and play back HDR video with AVFoundation - WWDC20-10009 - Export dialog hangs at 100%

I have downloaded and run this example. The Export command seems to hang when it hits 100%. Unfortunately I'm a noob and can't find the cause of the problem. The dialog processing seems a bit confusing for a new guy, I certainly don't pretend to understand the use of class, structs, etc. in this part of the example code.

I have been able to understand the metal processing, custom filters, etc.

I am running Mac OS 12.2.1, Xcode 13.3

Thanks to all for reading!

Somehow I was not able to add the tag for this in the 'search for a tag' on the web page.

Ok I've made a little progress. In ContentView.swift, there is a section of code that is trying to display the "Export Finished" alert. But the "Export Progress" alert is still being displayed at 100%. I've put a comment in the code where I think there needs to be some statement to close the "Export Progress" popup. I have no idea of how to do that.

alert(isPresented: $showingAlert) {
        switch alertReason {
        ... )
        case .exportDone:
           // need to close the previous alert for export progress!!!
           return Alert(title: Text("Export finished"), message: nil, dismissButton: Alert.Button.default(Text("OK"), action: {
            self.showingExportProgress = false
          })) .sheet(isPresented: $showingExportProgress) {
        ProgressPopup(isVisible: self.$showingExportProgress, title: Text("Exporting ..."), progressUpdateHandler: { () -> Float in
          return self.exportProgressChecker?.progress ?? 0
        })
      }

The ProgressPopup is a struct:

struct ProgressPopup: View { ...

Questions:

  1. Can I add a .close() function to the struct that would tell it to go away? What would it look like?

  2. The ProgressPopup is displayed with this statement:

.sheet(isPresented: $showingExportProgress) {
        ProgressPopup(isVisible: self.$showingExportProgress, title: Text("Exporting ..."), progressUpdateHandler: { () -> Float in
          return self.exportProgressChecker?.progress ?? 0
        })
      }

But there doesn't seem to be a variable that saves a reference to it anywhere, so even if I could make a close() function from question 1, I would still need to be able to invoke the new function to close the popup.

Thanks to all for reading!

after a lot of trial and error, I was able to fix the problem. I added the line with the comment below.

 exportProgressChecker = AssetExporter.exportAsynchronously(exportFileURL: dialog.url!) {
        if self.exportProgressChecker != nil && self.exportProgressChecker!.succeeded {
          
          self.showingExportProgress = false     // adding this line fixed the issue.

          self.triggerAlert(reason: .exportDone)
           
 
Edit and play back HDR video with AVFoundation - WWDC20-10009 - Export dialog hangs at 100%
 
 
Q