【问题标题】:Trimming ALAsset video using UIVideoEditorController使用 UIVideoEditorController 修剪 ALAsset 视频
【发布时间】:2011-05-19 11:05:49
【问题描述】:

我有一个视频类型的 ALAsset 对象。我想使用 UIVideoEditorController 修剪这个视频。以下是代码sn-p:

UIVideoEditorController *videoEditorController = [[UIVideoEditorController alloc] init];
videoEditorController.delegate = self;
videoEditorController.videoMaximumDuration = 0.0;
videoEditorController.videoQuality = UIImagePickerControllerQualityTypeHigh;
videoEditorController.videoPath = @"assets-library://asset/asset.MOV?id=1000000005&ext=MOV";
[inViewController presentModalViewController:videoEditorController animated:YES];
self.videoEditController = videoEditorController;
[videoEditorController release];

当 UIVideoEditorController 的 UI 被推送时,我收到一个错误“无法播放这部电影”。这里有什么问题?

【问题讨论】:

    标签: iphone trim alasset uivideoeditorcontroller


    【解决方案1】:

    您是在 iPhone 3Gs 还是 iPhone 4 上测试视频? 确保视频兼容 3G 播放。 我确定这只是问题所在。

    下面是代码 sn-p ....

    ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
    
    NSString *filePathString = [[NSBundle mainBundle] pathForResource:@"Don2" ofType:@"m4v"];
    NSURL *filePathURL = [NSURL fileURLWithPath:filePathString isDirectory:NO];
    if ([library videoAtPathIsCompatibleWithSavedPhotosAlbum:filePathURL]) {
        [library writeVideoAtPathToSavedPhotosAlbum:filePathURL completionBlock:^(NSURL *assetURL, NSError *error){
            if (error) {
                // TODO: error handling
                NSLog(@"Error");
            } else {
                // TODO: success handling
            }
        }];
    }
    [library release];
    

    【讨论】:

      【解决方案2】:

      videoEditorController.videoMaximumDuration = 0.0; ?你的意思是-videoEditorController.videoMaximumDuration = 1000.0;

      【讨论】:

      • @pat 没错! 0.0 是他在代码中输入的值。这就是为什么我问他是否打算输入另一个值,例如1000.0
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-01-30
      • 2015-10-27
      • 2015-03-08
      • 2023-04-02
      相关资源
      最近更新 更多