【问题标题】:How to select a video file and upload to server in iPhone programmatically如何以编程方式选择视频文件并上传到 iPhone 中的服务器
【发布时间】:2011-01-20 08:18:22
【问题描述】:

我想选择一个位于我 iPhone 中的视频文件,并且必须将它上传到服务器。

由于 UIImagePicker 用于选择照片库中可用的图片或其他模式,是否有任何选项可以以编程方式选择位于我们 iPhone 中的文件?

【问题讨论】:

    标签: iphone video


    【解决方案1】:

    使用资产库。参考这个问题:Accessing Videos in library using AssetsLibrary framework iPhone?

    在搜索中,我发现this method 可以使用图像选择器控制器访问视频。

    【讨论】:

    • 您好,感谢您的回复,Assests 库是唯一的选择吗?
    • @Priya:据我所知,这是唯一的事情。我不能肯定地说没有其他东西。
    • 我添加了 assertLibrary 框架并包含了它的代码,但它无法识别,要包含哪些头文件?如果有任何示例或教程,请给我发送示例
    【解决方案2】:

    首先添加MediaPlayer 框架...

    然后从 mobile9.com 下载 mp4 类型的视频

    然后使用如下代码

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

    试试这个代码.....它正在工作..

    【讨论】:

      【解决方案3】:
      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];
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-09-05
        • 1970-01-01
        • 2011-10-10
        • 1970-01-01
        相关资源
        最近更新 更多