1. System albums and photos
Multimedia parameters with System presets
#import <MobileCoreServices/MobileCoreServices.h>
Uiimagepickercontroller photos and get system albums
Determine if support
BOOL ret = [Uiimagepickercontroller Issourcetypeavailable:uiimagepickercontrollersourcetypecamera];
Uiimagepickercontroller *imagepicker = [[Uiimagepickercontroller alloc] init];
Set Resource type
imagepicker.sourcetype = type;
Set up Proxy
imagepicker.delegate = self;
Allow subsequent processing of albums, etc.
imagepicker.allowsediting = YES;
[Self presentviewcontroller:imagepicker animated:yes completion:^{
}];
#pragma mark-uiimagepickercontrollerdelegate
When you click the Cancel button on the picker, the method that is triggered
-(void) Imagepickercontrollerdidcancel: (Uiimagepickercontroller *) picker{
NSLog (@ "cancel!!");
Realizing the dismiss of picker
[Picker Dismissviewcontrolleranimated:yes completion:^{
}];
}
Click the Choose button to trigger the method
Info with selected resources
-(void) Imagepickercontroller: (Uiimagepickercontroller *) Picker Didfinishpickingmediawithinfo: (NSDictionary *) info {
Determine the type of selected resource
NSString *mediatype = [info objectforkey:uiimagepickercontrollermediatype];
Kuttypeimage System preset Picture resource type
if ([MediaType isequaltostring: (NSString *) Kuttypeimage]) {
The proof was taken out of the picture
Get a selected picture from a dictionary
UIImage *image = [info objectforkey:uiimagepickercontrollereditedimage];
The picture taken from the camera occupies space: (1m-2m) around, you need to compress the picture, and then in the subsequent operation
Compress the original image into a 50*50 size
UIImage *smallimage = [[Imagetool Sharetool] Resizeimagetosize:cgsizemake (50,50) sizeofimage:image];
Self.view.backgroundColor = [Uicolor colorwithpatternimage:smallimage];
}
[Picker Dismissviewcontrolleranimated:yes completion:^{
}];
}
2.Video
Mpmovieplayerviewcontroller
@ "Http://hot.vrs.sohu.com/ipad1407291_4596271359934_4618512.m3u8"
Create a controller with a video player
_Playcontroller = [[Mpmovieplayerviewcontroller alloc] initwithcontenturl:url];
_playcontroller.movieplayer.moviesourcetype = Mpmoviesourcetypefile;
Presented in a modal way
[Self Presentviewcontroller:_playcontroller animated:yes completion:^{
}];
3. Audio
Avaudioplayer protocol method
#pragma mark-avaudioplayerdelegate
When successful playback completes a songs, call this method
-(void) audioplayerdidfinishplaying: (Avaudioplayer *) player successfully: (BOOL) flag{
NSLog (@ "Play end");
}
Audio and video