iphone - How Can i Get the List of all Video files from Library in ios sdk -
hi i'm working on videos , list of video files library display , playing videos in app. can 1 me.
allvideos = [[nsmutablearray alloc] init]; alassetslibrary *assetlibrary = [[alassetslibrary alloc] init]; [assetlibrary enumerategroupswithtypes:alassetsgroupall usingblock:^(alassetsgroup *group, bool *stop) { if (group) { [group setassetsfilter:[alassetsfilter allvideos]]; [group enumerateassetsusingblock:^(alasset *asset, nsuinteger index, bool *stop) { if (asset) { dic = [[nsmutabledictionary alloc] init]; alassetrepresentation *defaultrepresentation = [asset defaultrepresentation]; nsstring *uti = [defaultrepresentation uti]; nsurl *videourl = [[asset valueforproperty:alassetpropertyurls] valueforkey:uti]; nsstring *title = [nsstring stringwithformat:@"video %d", arc4random()%100]; uiimage *image = [self imagefromvideourl:videourl]; [dic setvalue:image forkey:@"image"]; [dic setvalue:title forkey:@"name"]; [dic setvalue:videourl forkey:@"url"]; [allvideos addobject:dic]; } }]; else { } } failureblock:^(nserror *error) { nslog(@"error enumerating assetlibrary groups %@\n", error); }];
Comments
Post a Comment