选择并上传 iphone 3g ios 4 的视频

发布于 2024-09-08 05:44:25 字数 1292 浏览 2 评论 0原文

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

我在这里发现了这个有用的问题,用于从 iPhone 将视频上传到服务器上。

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

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 来做到这一点。

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

谢谢 。

I want to upload a video from iPhone to a server somewhere.

I have found this useful question here for uploading a video on the server from iPhone.

The only problem here is picking the video. The code is using uiimagepickercontroller to pick up the video and I have a 3g phone which has not video in its photos app. I can't even put a video in it . I have a video only in iTunesU . Currently I am using following snippet for uiimagepickercontroller .

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];
    }

So I have to ask that is it necessary to pick a video from uiimagepickercontroller and if so how can I do so with my iPhone 3G .

Please tell me if the question is not readable.

Thanks .

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

若水微香 2024-09-15 05:44:25

据我所知,不支持 3G 视频。

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

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

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

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

“捆绑路径:
(其中 APPLCIATIONGUID 和用户是动态的,取决于登录的用户和 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 的情况下使用视频的唯一选项。

There is no video support for 3G that I am aware of.

In order to make it work (you could simulate it) you need to pass a mediaType of 'kutTypeMedia', which errors as not available on your device.

'If' you want to test, you can copy a video from the bundle, into your Camera Roll and test on the simulator.

Something like this to copy the video from the bundle to your camera roll:

Copy a video file from your bundle and save it to the album as below!

"Bundle Path :
(Where APPLCIATIONGUID and user are dynamic and depend on the logged on user and the applicationGUID)

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

Where APPLICATIONGUID is the GUID associated with your particular project. You can confirm that you are in the right folder by looking for the appropraite .app file.

Note:// I don't believe that this will work with a MOV but have tried nothing but a .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);*

Once this has been done - videos are available in your photo album for selecting should you be setting up your UIImagePickerController with the correct media type.

This is the only option I see that you have to work with Video without a 3GS.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文