iphone - I am capturing image by this code and i have to record video also how to do that? -


*i capturing image code have record video on clicking button , save please tell me should do? not getting because have captured image , save photo album have record video , store please 1 give me better idea *

 - (void)viewdidload    {    front=no;    self.modaltransitionstyle = uimodaltransitionstylecoververtical; barpicker.value = hue;     pickerarr=[[nsarray   alloc]initwithobjects:@"01",@"02",@"03",@"04",@"05",@"06",@"07",@"08",@"09",@"10", nil];    flashlighton=yes;   [flashbutton setimage:[uiimage imagenamed:@"off.png"] forstate:uicontrolstatenormal];   [camrabutton setimage:[uiimage imagenamed:@"camra.png"] forstate:uicontrolstatenormal]; session = [[avcapturesession alloc] init]; session.sessionpreset = avcapturesessionpresetmedium; calayer *viewlayer = self.vimagepreview.layer; avcapturevideopreviewlayer *capturevideopreviewlayer = [[avcapturevideopreviewlayer alloc] initwithsession:session]; capturevideopreviewlayer.frame = self.vimagepreview.bounds;  [self.vimagepreview.layer addsublayer:capturevideopreviewlayer]; [self.vimagepreview addsubview:flashbutton]; [self.vimagepreview addsubview:camrabutton]; avcapturedevice *device = [avcapturedevice defaultdevicewithmediatype:avmediatypevideo];  nserror *error = nil; input = [avcapturedeviceinput deviceinputwithdevice:device error:&error]; stillimageoutput = [[avcapturestillimageoutput alloc] init]; nsdictionary *outputsettings = [[nsdictionary alloc] initwithobjectsandkeys:  avvideocodecjpeg, avvideocodeckey, nil];  if (!input) {     // handle error appropriately.     nslog(@"error: trying open camera: %@", error); } else {     [session addinput:input];     [stillimageoutput setoutputsettings:outputsettings];     [session addoutput:stillimageoutput];  } [session startrunning]; [super viewdidload]; // additional setup after loading view nib. }     -(ibaction) capturenow  {  if (!front) {     if (flashlighton) {         avcapturedevice *device1 = [avcapturedevice defaultdevicewithmediatype:avmediatypevideo];         if ([device1 hastorch] && [device1 hasflash])         {             [device1 lockforconfiguration:nil];             [device1 settorchmode:avcapturetorchmodeon];             [device1 setflashmode:avcaptureflashmodeon];             [device1 unlockforconfiguration];         }     } }  avcaptureconnection *videoconnection = nil;  (avcaptureconnection *connection in stillimageoutput. connections) {     (avcaptureinputport *port in [connection inputports]) {         if ([[port mediatype] isequal:avmediatypevideo]) {             videoconnection = connection;             break;         }     }     if (videoconnection) {         break;     } }  nslog(@"about request capture from: %@", stillimageoutput); [stillimageoutput capturestillimageasynchronouslyfromconnection:videoconnection                                completionhandler:^(cmsamplebufferref imagesamplebuffer, nserror *error)   {      cfdictionaryref exifattachments = cmgetattachment(imagesamplebuffer, kcgimagepropertyexifdictionary, null);      if (exifattachments) {       }      else {      }      nsdata *imagedata = [avcapturestillimageoutput jpegstillimagensdatarepresentation:imagesamplebuffer];       image.image = [[uiimage alloc] initwithdata:imagedata];      }];    } 

sorry can't edit code providing links achieve task..

http://www.raywenderlich.com/13418/how-to-play-record-edit-videos-in-ios

http://www.techotopia.com/index.php/an_example_ios_6_iphone_camera_application

just check out these links..

enjoy..


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -