How to select a video file and upload to server in iPhone programmatically

后端 未结 3 1418
天涯浪人
天涯浪人 2021-02-11 03:49

I want to select an video file located in my iPhone and have to upload it to the server.

As UIImagePicker is used to select pictures available in our photo library or so

相关标签:
3条回答
  • 2021-02-11 04:43

    First Add the MediaPlayer Framework...

    Then download video of type mp4 from mobile9.com

    then use the code as follows

    NSString *url=[[NSBundle mainBundle] pathForResource: @"video" ofType:@"mp4"];
    
    MPMoviePlayerController *play1= [[MPMoviePlayerController alloc] initWithContentURL:[NSURL 
    fileURLwithPath:url];
    
    [play1 setOrientation:UIDeviceOrientationPortrait animated:YES];
    
    [paly1 play];
    

    try this code .....it's working..

    0 讨论(0)
  • 2021-02-11 04:43
    to select video from photo library use following code:
     UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
        imagePicker.delegate = self;
        imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
        imagePicker.mediaTypes = [[NSArray alloc] initWithObjects:(NSString *)kUTTypeMovie, nil];
    
        [self presentViewController:imagePicker animated:YES completion:NULL];
    
    0 讨论(0)
  • 2021-02-11 04:45

    Use Assets library. Refer this question: Accessing Videos in library using AssetsLibrary framework iPhone?

    And on searching, I found this method to access videos using image picker controller.

    0 讨论(0)
提交回复
热议问题