     }
     
     func resourceLoader(resourceLoader: AVAssetResourceLoader, shouldWaitForLoadingOfRequestedResource loadingRequest: AVAssetResourceLoadingRequest) -> Bool {
-//        pendingRequests.append(loadingRequest);
-//        debugLog("new request, now \(pendingRequests.count) pending requests")
         
         if videoCache.canFulfillLoadingRequest(loadingRequest) {
             if videoCache.fulfillLoadingRequest(loadingRequest) {

    }

    init(URL:NSURL) {
//        self.URL = URL;
        self.URL = NSURL(string:"http://localhost/test.mov")!
        videoCache = VideoCache(URL: URL)
    }
    

    let assetLoader = AssetLoaderDelegate(URL: URL);
    
    let asset = AVURLAsset(URL: assetLoader.URLWithCustomScheme);
    let queue = dispatch_get_main_queue();
    asset.resourceLoader.setDelegate(assetLoader, queue: queue)
    objc_setAssociatedObject(asset, "assetLoader", assetLoader, objc_AssociationPolicy.OBJC_ASSOCIATION_RETAIN_NONATOMIC);
    
    return asset
}


class AssetLoaderDelegate : NSObject, AVAssetResourceLoaderDelegate, VideoLoaderDelegate {
 
    let URL:NSURL
    var videoLoaders:[VideoLoader] = []
    let videoCache:VideoCache
    
    var URLWithCustomScheme:NSURL {
        let components = NSURLComponents(URL: URL, resolvingAgainstBaseURL: false)!;
