Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
1and2papa committed Jun 24, 2014
1 parent 97c0841 commit ceed785
Showing 1 changed file with 28 additions and 28 deletions.
56 changes: 28 additions & 28 deletions README.md
Expand Up @@ -10,10 +10,11 @@ CTAssetsPickerController is an iOS controller that allows picking multiple photo

## Features
1. Picks multiple photos and videos across albums from user's library.
2. Filters assets for picking only photos or videos.
3. Filters assets or albums by their properties.
4. Achieves average 5x fps.
5. Conforms UIAccessibility Protocol.
2. Previews assets by long-press gesture.
3. Filters assets for picking only photos or videos.
4. Filters assets or albums by their properties.
5. Achieves average 5x fps.
6. Conforms UIAccessibility Protocol.


## What's new
Expand Down Expand Up @@ -214,11 +215,11 @@ An `NSNotification` object named `CTAssetsPickerSelectedAssetsChangedNotificatio
You may reuse the preview feature of the picker to view any assets. Just init a `CTAssetsPageViewController` with an array of assets and assign `pageIndex` property. Please refer to the demo app.

```` objective-c
NSArray *assets = @[asset1, asset2, asset3, ...];
CTAssetsPageViewController *vc = [[CTAssetsPageViewController alloc] initWithAssets:assets];
vc.pageIndex = assets.count - 1; // display the last asset
[self.navigationController pushViewController:vc animated:YES];
NSArray *assets = @[asset1, asset2, asset3, ...];
CTAssetsPageViewController *vc = [[CTAssetsPageViewController alloc] initWithAssets:assets];
vc.pageIndex = assets.count - 1; // display the last asset

[self.navigationController pushViewController:vc animated:YES];
````
Expand All @@ -233,37 +234,36 @@ CTAssetsPickerController does not compress the picked photos and videos. You can
For example, you can create `UIImage` from picked assets like this:-
```` objective-c
ALAssetRepresentation *representation = alAsset.defaultRepresentation;
ALAssetRepresentation *representation = alAsset.defaultRepresentation;
UIImage *fullResolutionImage =
[UIImage imageWithCGImage:representation.fullResolutionImage
scale:1.0f
orientation:(UIImageOrientation)representation.orientation];
UIImage *fullResolutionImage =
[UIImage imageWithCGImage:representation.fullResolutionImage
scale:1.0f
orientation:(UIImageOrientation)representation.orientation];
````

and create `NSData` of picked vidoes:-

```` objective-c
ALAssetRepresentation *representation = alAsset.defaultRepresentation;

NSURL *url = representation.url;
AVAsset *asset = [AVURLAsset URLAssetWithURL:url options:nil];
ALAssetRepresentation *representation = alAsset.defaultRepresentation;

AVAssetExportSession *session =
[AVAssetExportSession exportSessionWithAsset:asset presetName:AVAssetExportPresetLowQuality];
NSURL *url = representation.url;
AVAsset *asset = [AVURLAsset URLAssetWithURL:url options:nil];

session.outputFileType = AVFileTypeQuickTimeMovie;
session.outputURL = VIDEO_EXPORTING_URL;
AVAssetExportSession *session =
[AVAssetExportSession exportSessionWithAsset:asset presetName:AVAssetExportPresetLowQuality];

[session exportAsynchronouslyWithCompletionHandler:^{
session.outputFileType = AVFileTypeQuickTimeMovie;
session.outputURL = VIDEO_EXPORTING_URL;

if (session.status == AVAssetExportSessionStatusCompleted)
{
NSData *data = [NSData dataWithContentsOfURL:session.outputURL];
}
[session exportAsynchronouslyWithCompletionHandler:^{

}];
if (session.status == AVAssetExportSessionStatusCompleted)
{
NSData *data = [NSData dataWithContentsOfURL:session.outputURL];
}

}];
````
Please refer the documentation of `ALAssetRepresentation` and `AVAssetExportSession`.
Expand Down

0 comments on commit ceed785

Please sign in to comment.