【问题标题】:picking and uploading the video for iphone 3g ios 4为 iphone 3g ios 4 挑选和上传视频
【发布时间】:2011-03-11 09:04:19
【问题描述】:

我想将视频从 iPhone 上传到某处的服务器。

我在这里找到了this 有用的问题,用于从 iPhone 上传服务器上的视频。

这里唯一的问题是选择视频。该代码使用 uiimagepickercontroller 来获取视频,我有一部 3g 手机,它的照片应用程序中没有视频。我什至不能在里面放视频。我只有在 iTunesU 中有一个视频。目前我正在为 uiimagepickercontroller 使用以下 sn-p 。

if ([UIImagePickerController isSourceTypeAvailable:
         UIImagePickerControllerSourceTypeSavedPhotosAlbum]) {
        UIImagePickerController *picker =
        [[UIImagePickerController alloc] init];
        picker.delegate = self;
        picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
        [self presentModalViewController:picker animated:YES];
        [picker release];
    }
    else {
        UIAlertView *alert = [[UIAlertView alloc]
                              initWithTitle:@"Error accessing photo library"
                              message:@"Device does not support a photo library"
                              delegate:nil
                              cancelButtonTitle:@"Drat!"
                              otherButtonTitles:nil];
        [alert show];
        [alert release];
    }

所以我不得不问是否有必要从 uiimagepickercontroller 中选择一个视频,如果是的话,我该如何使用我的 iPhone 3G 来选择。

如果问题不可读,请告诉我。

谢谢。

【问题讨论】:

    标签: iphone video upload uiimagepickercontroller


    【解决方案1】:

    据我所知,没有对 3G 的视频支持。

    为了使其工作(您可以模拟它),您需要传递“kutTypeMedia”的媒体类型,该错误在您的设备上不可用。

    “如果”您想测试,您可以将视频包中的视频复制到您的相机胶卷中并在模拟器上测试。

    像这样将视频从捆绑包复制到相机胶卷:

    从您的捆绑包中复制一个视频文件并将其保存到相册中,如下所示!

    "捆绑路径: (其中 APPCIATIONGUID 和用户是动态的,取决于登录的用户和 applicationGUID)

    '/Users/user/Library/Application Support/iPhone Simulator/4.0/Applications/APPLICATIONGUID/Documents'

    APPLICATIONGUID 是与您的特定项目关联的 GUID。您可以通过查找适当的 .app 文件来确认您在正确的文件夹中。

    注意://我不相信这适用于 MOV,但除了 .m4v 之外什么也没尝试。

    NSString  *filePath = [NSHomeDirectory() stringByAppendingPathComponent:[NSString stringWithFormat:@"Documents/VID_0001.m4v"]];
    
    NSString  *videoFilepath = [[NSBundle mainBundle] pathForResource:@"VID"  ofType:@"m4v"];
    NSLog(@"Filepath is: %@", videoFilepath);
    
    //test video can save to the photos album first - code missing
    
    UISaveVideoAtPathToSavedPhotosAlbum(filePath, self, @selector(video:didFinishSavingWithError:contextInfo:), nil);*
    

    完成此操作后,如果您要使用正确的媒体类型设置 UIImagePickerController,则可以在相册中选择视频。

    这是我看到您必须在没有 3GS 的情况下使用视频的唯一选项。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-09-24
      • 2021-07-06
      相关资源
      最近更新 更多