Giter VIP home page Giter VIP logo

Comments (6)

zhangao0086 avatar zhangao0086 commented on May 26, 2024

I'm sorry for my late reply...
I've added an API to fetch AVAsset that receives a PHVideoRequestOptions parameter.

/**
Fetch an AVAsset with a completeBlock and PHVideoRequestOptions.
*/
public func fetchAVAsset(options: PHVideoRequestOptions?, completeBlock: (AVAsset: AVURLAsset?) -> Void) {
    getImageManager().fetchAVAsset(self, options: options, completeBlock: completeBlock)
}

from dkimagepickercontroller.

kimcrab avatar kimcrab commented on May 26, 2024

@zhangao0086

Wow It seems great!
But how can I change synchronous value to TRUE?
PHVideoRequestOptions does not have synchronous value.

public class PHVideoRequestOptions : NSObject {
public var networkAccessAllowed: Bool
public var version: PHVideoRequestOptionsVersion
public var deliveryMode: PHVideoRequestOptionsDeliveryMode
public var progressHandler: PHAssetVideoProgressHandler?
}

Plus, Can you give me a small example how to pass Options to function fetchAVAsset?

Thanks in advance

from dkimagepickercontroller.

zhangao0086 avatar zhangao0086 commented on May 26, 2024

The PHVideoRequestOptions does not support synchronous...
I'll add some helper function to do it.

from dkimagepickercontroller.

kimcrab avatar kimcrab commented on May 26, 2024

@zhangao0086

That's awesome.

Please let me know when you finished.

from dkimagepickercontroller.

zhangao0086 avatar zhangao0086 commented on May 26, 2024

I've added a function to sync fetch AVAsset:

/**
Sync fetch an AVAsset with a completeBlock and PHVideoRequestOptions.
*/
public func fetchAVAsset(sync: Bool, options: PHVideoRequestOptions?, completeBlock: (AVAsset: AVURLAsset?) -> Void) {
    if sync {
        let semaphore = dispatch_semaphore_create(0)
        self.fetchAVAsset(nil, completeBlock: { (AVAsset) -> Void in
            completeBlock(AVAsset: AVAsset)
            dispatch_semaphore_signal(semaphore)
        })
        dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER)
    } else {
        self.fetchAVAsset(nil, completeBlock: completeBlock)
    }
}

from dkimagepickercontroller.

kimcrab avatar kimcrab commented on May 26, 2024

@zhangao0086 Wow.. You are AWESOME!! What a quick response!
Thanks dude. I'll close the issue.

from dkimagepickercontroller.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.