rFlex / SCRecorder

iOS camera engine with Vine-like tap to record, animatable filters, slow motion, segments editing
Apache License 2.0
3.06k stars 583 forks source link

setItemByStringPath #138

Open anil03 opened 9 years ago

anil03 commented 9 years ago

hi i am trying to crop the video which is recorded by screcorder. When i exported the video using : below code

AVAsset asset = _recordSession.assetRepresentingSegments; SCAssetExportSession assetExportSession = [[SCAssetExportSession alloc] initWithAsset:asset]; assetExportSession.outputUrl = _recordSession.outputUrl; assetExportSession.outputFileType = AVFileTypeMPEG4; assetExportSession.videoConfiguration.filter = [SCFilter filterWithCIFilterName:@"CIPhotoEffectInstant"]; assetExportSession.videoConfiguration.preset = SCPresetHighestQuality; assetExportSession.audioConfiguration.preset = SCPresetMediumQuality; [assetExportSession exportAsynchronouslyWithCompletionHandler: ^{ if (assetExportSession.error == nil) {

        // We have our video and/or audio file
        NSString *tmpDirectory = NSTemporaryDirectory();
        NSString *tmpFile = [tmpDirectory stringByAppendingPathComponent:@"live_media.mp4"];
        NSLog(@"Temp File:%@", tmpFile);
        exportedStringPath = tmpFile;
        [self performSegueWithIdentifier:@"Video" sender:self];

    }
    else {
        // Something bad happened
    }
}];

than i sending it to new controller. there i am trying to play a recorded video using setItemByStringPath. than record player is not able to play that file. created filepath is look like this /private/var/mobile/Containers/Data/Application/0F646972-3A09-4749-A0A5-A100521C11E3/tmp/live_media.mp4 Please suggest what is error. i am doing wrong. let me know because i am trying to create Vine like App which has editing capablity.

rFlex commented 9 years ago

I'm not sure what you are trying to do inside your completion handler block. The exported video url is defined in the outputUrl property of SCAssetExportSession, therefore this is the url you should use if you want to play back the compressed video.

Here I see that you are just creating an NSString corresponding to a path, but there is nothing that show that you actually wrote a file on this filePath.