开发者

Does video recording supports in iPhone 3g (programmatically) in iOS?

I am using the code below for recording the video as it is worked smoothly in iPhone 3Gs and iPhone 4. But in iPhone 3G it was not working.

  - (void)imagePickerController:(UIImagePickerController *)picker1 didFinishPickingMediaWithInfo:(NSDictionary *)info 
    {
    printf("\n INSIDE......didFinishPickingMediaWithInfo");
        NSString *mediaType = [info objectForKey:UIImagePickerControllerMediaType];
    printf("\n mediaType = %s",[mediaType UTF8String]);

    if ([mediaType isEqualToString:@"public.movie"]) 
    {
                NSLog(@"got a movie");
        videoURL = [info objectForKey:UIImagePickerControllerMediaURL];
        newURL = [videoURL copy];
        NSLog(@"Video Url = %@",videoURL);

        moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:newURL];
        if (moviePlayer)
        {
            //[moviePlayer s开发者_如何学运维etControlStyle:MPMovieControlStyleFullscreen];
            //[moviePlayer setFullscreen:YES];
            //[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleDurationAvailableNotification:)

                       // name:MPMovieDurationAvailableNotification
                                                                                      //object:moviePlayer];
            ////moviePlayer.useApplicationAudioSession = NO;
            //UIImage *image = [moviePlayer  thumbnailImageAtTime:(NSTimeInterval)1.0 timeOption: MPMovieTimeOptionNearestKeyFrame];
            //NSData *imgData = UIImagePNGRepresentation(image);
            //thumbnailData =[imgData copy];
            //printf("\n length of ThumbnailImage Data...%d",[imgData length]);
        }

        NSData *webData = [NSData dataWithContentsOfURL:videoURL];
        webData1 = [webData copy];

        myAlertView = [[UIAlertView alloc] initWithTitle:@"Enter the Message title" message:@"................." delegate:self cancelButtonTitle:@"No title" otherButtonTitles:@"Ok",nil];
        CGAffineTransform myTransform = CGAffineTransformMakeTranslation(0.0, 80.0);
        [myAlertView setTransform:myTransform];
        [myAlertView addSubview:messageTitleTextField];
        [messageTitleTextField setFont:[UIFont boldSystemFontOfSize:14]];
        messageTitleTextField.returnKeyType = UIReturnKeyDone;
        messageTitleTextField.keyboardAppearance  = UIKeyboardAppearanceDefault;
        messageTitleTextField.keyboardType = UIKeyboardTypeDefault;
        messageTitleTextField.delegate = self;
        [myAlertView show];
        //[mview addSubview:myAlertView];

        UILabel *theTitle = [myAlertView valueForKey:@"_titleLabel"];
        [theTitle setTextColor:[UIColor orangeColor]];

        UILabel *theBody = [myAlertView valueForKey:@"_bodyTextLabel"];
        [theBody setTextColor:[UIColor whiteColor]];

        UIImage *theImage2 = [UIImage imageNamed:@"voicebg.png"];    
        theImage2 = [theImage2 stretchableImageWithLeftCapWidth:16 topCapHeight:16];
        CGSize theSize = [myAlertView frame].size;

        UIGraphicsBeginImageContext(theSize);    
        [theImage2 drawInRect:CGRectMake(0, 0, theSize.width, theSize.height)];    
        theImage2 = UIGraphicsGetImageFromCurrentImageContext();    
        UIGraphicsEndImageContext();
        myAlertView.layer.contents = (id)[theImage2 CGImage];
        [myAlertView release];
        //[webData release];
        [picker1 dismissModalViewControllerAnimated:YES];
    }   
}


The 3G only has still capture capabilities. Some developers have got round this by capturing multiple pictures in quick succession and converting it to a video.

This blog has a article on what video options are avaliable, it's a year old but hopefully you will be able to understand what they all did.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜