Eine aufbereitete Darstellung der Quelle

 
     
 
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung


Quelle  AVAsset+Extensions.swift   Sprache: JAVA

 

import AVFoundation.AVAsset

extension AVAsset {

    /// Method to get the AVAsset isExportable synchronously wrapping an async call.
    /// It blocks the Main Thread using a semaphore, but with a timeout of 0.1 seconds
    /// Only use this  if the  async version `await asset.load(isExportable)` is temporarily not possible
    func loadIsExportableSynchronously(timeout: TimeInterval = 0.1) -> Bool {
        let semaphore = DispatchSemaphore(value: 0)
        var result = false

        Task {
            result = await (try? self.load(.isExportable)) ?? false
            semaphore.signal()
        }

        let timeoutResult = semaphore.wait(
            timeout: .now() + timeout
        )

        if timeoutResult == .timedOut {
            return false
        }

        return result
    }
}

Messung
CHZG
849410092

¤ Dauer der Verarbeitung: 0.33 Sekunden  ¤

*© Formatika GbR, Deutschland







                                                                                                                                                                                                                                                                                                                                                                                                     

 

Neuigkeiten

Aktuelles
Motto des Tages

Open Source Software


Gedichte
Musik
Bilder

Jenseits des Üblichen

Besucherstatistik

Besucherstatistik

Statistik
#Sources=1,187,811
#Domains=881,136