Giter Site home page Giter Site logo

dvassetloaderdelegate's Introduction

DVAssetLoaderDelegate

Version License Platform

Description

With DVAssetLoaderDelegate you can implement caching data downloaded by AVPlayer for AVURLAsset. DVAssetLoaderDelegate provides you delegate method you can use to save downloaded data:

- (void)dvAssetLoaderDelegate:(DVAssetLoaderDelegate *)resourceLoader
                  didLoadData:(NSData *)data
                       forURL:(NSURL *)url;

For other methods check DVAssetLoaderDelegatesDelegate.h.

Usage

Easy way (subclassing AVURLAsset)

  1. Create DVURLAsset.
  2. Implement DVURLAsset's loaderDelegate.

Manual way (without subclassing)

  1. Create DVAssetLoaderDelegate object using URL for AVURLAsset.
  2. Set DVAssetLoaderDelegate delegate for receiving cache data.
  3. Before creating AVURLAsset, change URL scheme to [DVAssetLoaderDelegate scheme].
  4. Create AVURLAsset with URL with updated scheme.
  5. Set AVURLAsset's resource loader delegate to created DVAssetLoaderDelegate object.
NSURL *URL = ...;

DVAssetLoaderDelegate *resourceLoaderDelegate = [[DVAssetLoaderDelegate alloc] initWithURL:URL];
resourceLoaderDelegate.delegate = self;


NSURLComponents *components = [[NSURLComponents alloc] initWithURL:URL resolvingAgainstBaseURL:NO];
components.scheme = [DVAssetLoaderDelegate scheme];

AVURLAsset *asset = [[AVURLAsset alloc] initWithURL:[components URL] options:options];
[asset.resourceLoader setDelegate:resourceLoaderDelegate queue:dispatch_get_main_queue()];

Installation

DVAssetLoaderDelegate is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'DVAssetLoaderDelegate'

Author

vdugnist, [email protected]

License

DVAssetLoaderDelegate is available under the MIT license. See the LICENSE file for more info.

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.