0

iPadアプリケーションでビデオを録画していますが、正常に動作していますが、問題は、ユーザーが最大30秒にバインドされてアラートを表示する方法でのみ、最大30秒のビデオを録画できることです。

-(void)onHomeButtonClickVideo{

UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;

if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
   {
    NSArray *mediaTypes = [NSArray arrayWithObject:(NSString*)kUTTypeMovie];
    picker.mediaTypes = mediaTypes ;
    picker.sourceType = UIImagePickerControllerSourceTypeCamera;
    picker.cameraCaptureMode = UIImagePickerControllerCameraCaptureModeVideo ;
[self presentModalViewController:picker animated:NO];
[picker release];
}
   else
    {   
    UIAlertView *alt=[[UIAlertView alloc]initWithTitle:@"Error" message:@" Camera Facility is not available with this Device" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
    [alt show];
    [alt release];
}
}
4

2 に答える 2

0

まず、イメージ ピッカー オブジェクトを .h ファイルのプロパティとして作成します。

このようなコード

 -(void)onHomeButtonClickVideo{

picker = [[UIImagePickerController alloc] init];
picker.delegate = self;

if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])

   {
    NSArray *mediaTypes = [NSArray arrayWithObject:(NSString*)kUTTypeMovie];
    picker.mediaTypes = mediaTypes ;
    picker.sourceType = UIImagePickerControllerSourceTypeCamera;
    picker.cameraCaptureMode = UIImagePickerControllerCameraCaptureModeVideo ;
[self presentModalViewController:picker animated:NO];

[self performSelector:@selector(stopCapturingVideoAfterSomeTime) withObject:nil afterDelay:30];

}

   else
    {


    UIAlertView *alt=[[UIAlertView alloc]initWithTitle:@"Error" message:@" Camera Facility is not available with this Device" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
    [alt show];
    [alt release];


}


-(void)stopCapturingVideoAfterSomeTime
{
   [picker stopVideoCapture];

 // what ever code you want at the time of video stop : show alert or any thing
}
于 2013-06-05T05:58:09.120 に答える
0

以下のコードを使用してください

     UIImagePickerController* picker = .......
        picker.mediaTypes = [NSArray arrayWithObject:(NSString *)kUTTypeMovie];
        picker.videoMaximumDuration = 30; //in seconds
        record.saveToAlbum = YES;
        [self loadCamScreensWithPicker:picker];

 NSURL *videoURL = [info objectForKey:UIImagePickerControllerMediaURL];
 NSData *data_Page = [NSData dataWithContentsOfURL:videoURL];
 if (([data_Page length]/1024/1024)<=30) 
    {

       // Not Exceed 30 SEC
    }
    else{

       // Exceed 30 Seconds
    }
于 2013-06-05T06:04:52.433 に答える