0

Actually I want to fix Video orientation issue when a Video is capture on device in portrait or landscape mode. For solving this issue I have this link

How to fix video orientation issue in iOS

and I have also google for solving orientation issue , Every approach need a asset url.So Please tell me how to get reference url when a video is capture from camera.

Currently I am getting UIImagePickerControllerMediaURL in

 - (void) imagePickerController: (UIImagePickerController *) picker
     didFinishPickingMediaWithInfo: (NSDictionary *) info
 { 
    NSUrl * url =[info objectForKey:UIImagePickerControllerMediaURL];
    NSlog("Url is ::::%@",url);
 }

But I want to get UIImagePickerControllerReferenceURL for recently recorded video.Please guide me .

Community
  • 1
  • 1

1 Answers1

1

Hi you can try with this one. It will give the referenced url of the video.

// For responding to the user accepting a newly-captured picture or movie
- (void)video:(NSString*)videoPath didFinishSavingWithError:(NSError*)error contextInfo:(void*)contextInfo
{

        NSString *str=@"file://localhost";
        NSString *appendPath=[str stringByAppendingString:videoPath];

        NSURL *urlVideo = [NSURL URLWithString:[appendPath stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];


            AVURLAsset *asset = [AVURLAsset assetWithURL: urlVideo];
            Float64 duration = CMTimeGetSeconds(asset.duration);

            NSString *strTime = [[NSString alloc] initWithString:[NSString stringWithFormat:@"%f",duration]];

            DLog(@"strTime ==%@",strTime);
}

Thanks

Harunmughal
  • 367
  • 1
  • 4
  • didFinishSavingWithError , when this method is called , I think ,It will be called when some error is come .Please explain some more – user3627622 May 29 '14 at 07:34
  • No It will be called when video did finish saving if any error will be there then it will return the error. – Harunmughal May 29 '14 at 08:36
  • Thanks for reply .But I need asset url seems like that UIImagePickerControllerReferenceURL = "assets-library://asset/asset.MOV?id=C40988C3-B7D3-42BA-8556-AD72A8BE6055&ext=MOV" – user3627622 May 29 '14 at 09:20