Skip to content

Commit

Permalink
delete doReserverEffect function
Browse files Browse the repository at this point in the history
  • Loading branch information
Kivenhaoyu committed Oct 12, 2019
1 parent 61b9cc4 commit 5b60a13
Showing 1 changed file with 0 additions and 184 deletions.
184 changes: 0 additions & 184 deletions Example/PLShortVideoKitDemo/EditViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -2292,190 +2292,6 @@ - (void)joinNextViewController:(NSURL *)url {
[self presentViewController:playViewController animated:YES completion:nil];
}

//- (void)doReserverEffect:(BOOL)removeAudio {
// [self.shortVideoEditor stopEditing];
// self.playButton.selected = YES;
//
// [self loadActivityIndicatorView];
//
// if (self.reverser.isReversing) {
// NSLog(@"reverser effect isReversing");
// return;
// }
//
// if (self.reverser) {
// self.reverser = nil;
// }
//
// __weak typeof(self)weakSelf = self;
// AVAsset *asset = self.movieSettings[PLSAssetKey];
// self.reverser = [[PLSReverserEffect alloc] initWithAsset:asset];
// self.reverser.audioRemoved = removeAudio;
// self.inputAsset = self.movieSettings[PLSAssetKey];
// [self.reverser setCompletionBlock:^(NSURL *url) {
//
// NSLog(@"reverser effect, url: %@", url);
// // 贴纸信息
// [weakSelf.stickerSettingsArray removeAllObjects];
// if ([self.timelineView getAllAddedItems].count != 0) {
// for (int i = 0; i < [self.timelineView getAllAddedItems].count; i++) {
// PLSTimeLineItem *item = [weakSelf.timelineView getAllAddedItems][i];
//
// NSMutableDictionary *stickerSettings = [[NSMutableDictionary alloc] init];
// PLSStickerView *stickerView = (PLSStickerView *)item.target;
//
// CGAffineTransform transform = stickerView.transform;
// CGFloat widthScale = sqrt(transform.a * transform.a + transform.c * transform.c);
// CGFloat heightScale = sqrt(transform.b * transform.b + transform.d * transform.d);
// CGSize viewSize = CGSizeMake(stickerView.bounds.size.width * widthScale, stickerView.bounds.size.height * heightScale);
// CGPoint viewCenter = CGPointMake(stickerView.frame.origin.x + stickerView.frame.size.width / 2, stickerView.frame.origin.y + stickerView.frame.size.height / 2);
// CGPoint viewPoint = CGPointMake(viewCenter.x - viewSize.width / 2, viewCenter.y - viewSize.height / 2);
//
// stickerSettings[PLSSizeKey] = [NSValue valueWithCGSize:viewSize];
// stickerSettings[PLSPointKey] = [NSValue valueWithCGPoint:viewPoint];
//
// CGFloat rotation = atan2f(transform.b, transform.a);
// rotation = rotation * (180 / M_PI);
// stickerSettings[PLSRotationKey] = [NSNumber numberWithFloat:rotation];
//
// stickerSettings[PLSStartTimeKey] = [NSNumber numberWithFloat:item.startTime];
// stickerSettings[PLSDurationKey] = [NSNumber numberWithFloat:(item.endTime - item.startTime)];
// stickerSettings[PLSVideoPreviewSizeKey] = [NSValue valueWithCGSize:weakSelf.stickerOverlayView.frame.size];
// stickerSettings[PLSVideoOutputSizeKey] = [NSValue valueWithCGSize:self.videoSize];
//
// if (StickerType_Gif == stickerView.stickerType) {
// // 如果贴纸是 GIF 类型,PLSStickerKey 的 value 必须是下列三种中的某一种:
// int type = arc4random() % 3;
// if (0 == type) {
// // value = GIF URL
// stickerSettings[PLSStickerKey] = stickerView.stickerURL;
// } else if (1 == type) {
// // value = GIF path
// stickerSettings[PLSStickerKey] = stickerView.stickerURL.path;
// } else if (2 == type) {
// // value = GIF data
// stickerSettings[PLSStickerKey] = [NSData dataWithContentsOfFile:stickerView.stickerURL.path];
// }
//
// } else {
//#if 0
// // v2.0.0 及之前的版本添加静态贴纸的方式, 传入的是 stickerView。如果传入的是 stickerView,添加了滤镜或者特效,这些效果会作用到贴纸上。如果不希望贴纸被滤镜和特效作用,则需要使用新的添加贴纸的方式
// stickerView.hidden = NO;
// stickerSettings[PLSStickerKey] = stickerView;
//#else
// // ===== 新的静态贴纸添加方式,v2.1.0 之后生效,建议所有用户换成新的添加贴纸方式 ======
// if (StickerType_Image == stickerView.stickerType) {
// int type = arc4random() % 4;
// if (0 == type) {
// // value = image URL
// stickerSettings[PLSStickerKey] = stickerView.stickerURL;
// } else if (1 == type) {
// // value = image path
// stickerSettings[PLSStickerKey] = stickerView.stickerURL.path;
// } else if (2 == type) {
// // value = image data
// // 如果贴纸晗 alpha 通道,使用 UIImageJPEGRepresentation(stickerView.image, 1) 得到的是没有 alpha 的图片,建议使用 UIImagePNGRepresentation(stickerView.image) 来获取 data
// stickerSettings[PLSStickerKey] = UIImagePNGRepresentation(stickerView.stickerImage);
// } else {
// // value = image
// stickerSettings[PLSStickerKey] = stickerView.stickerImage;
// }
// } else if (StickerType_Text == stickerView.stickerType) {
// // 文字
// stickerView.hidden = NO;
// stickerSettings[PLSStickerKey] = [self convertViewToImage:stickerView];
// }
//#endif
// }
// [self.stickerSettingsArray addObject:stickerSettings];
// }
// }
//
// // 添加背景音乐信息
// if (self.backgroundAudioSettings[PLSURLKey] && ![self.audioSettingsArray containsObject:self.backgroundAudioSettings]) {
// [self.audioSettingsArray insertObject:self.backgroundAudioSettings atIndex:0];
// }
//
// AVAsset *asset = [AVAsset assetWithURL:url];
// PLSAVAssetExportSession *exportSession = [[PLSAVAssetExportSession alloc] initWithAsset:asset];
// exportSession.outputFileType = PLSFileTypeMPEG4;
// exportSession.shouldOptimizeForNetworkUse = YES;
// exportSession.outputSettings = self.outputSettings;
// exportSession.delegate = self;
// exportSession.isExportMovieToPhotosAlbum = YES;
// exportSession.audioChannel = 2;
// exportSession.audioBitrate = PLSAudioBitRate_128Kbps;
// exportSession.outputVideoFrameRate = MIN(60, asset.pls_normalFrameRate);
// // // 设置视频的码率
// // exportSession.bitrate = 3000*1000;
// // // 设置视频的输出路径
// // exportSession.outputURL = [self getFileURL:@"outputMovie"];
//
// // 设置视频的导出分辨率,会将原视频缩放
// exportSession.outputVideoSize = self.videoSize;
//
// // 旋转视频
// exportSession.videoLayerOrientation = self.videoLayerOrientation;
// if (self.colorImagePath) {
// [exportSession addFilter:self.colorImagePath];
// }
// if (self.colorURL && self.alphaURL) {
// [exportSession addMVLayerWithColor:self.colorURL alpha:self.alphaURL timeRange:kCMTimeRangeZero loopEnable:YES];
// }
//
// [exportSession setCompletionBlock:^(NSURL *url) {
// NSLog(@"Asset Export Completed");
//
// dispatch_async(dispatch_get_main_queue(), ^{
// [weakSelf joinNextViewController:url];
// });
// }];
//
// [exportSession setFailureBlock:^(NSError *error) {
// NSLog(@"Asset Export Failed: %@", error);
//
// dispatch_async(dispatch_get_main_queue(), ^{
// [weakSelf removeActivityIndicatorView];
// AlertViewShow(error);
// });
// }];
//
// // __weak typeof(self)weaksSelf = weakSelf;
// [exportSession setProcessingBlock:^(float progress) {
// // 更新进度 UI
// NSLog(@"Asset Export Progress: %f %d", progress,(int)(50+(progress * 50)));
// dispatch_async(dispatch_get_main_queue(), ^{
// weakSelf.progressLabel.text = [NSString stringWithFormat:@"%d%%", (int)(50+(progress * 50))];
// });
// }];
//
// [exportSession exportAsynchronously];
//
// }];
//
// [self.reverser setFailureBlock:^(NSError *error){
// [weakSelf removeActivityIndicatorView];
//
// NSLog(@"reverser effect, error: %@",error);
//
// weakSelf.movieSettings[PLSAssetKey] = weakSelf.inputAsset;
//
// [weakSelf.shortVideoEditor replaceCurrentAssetWithAsset:weakSelf.movieSettings[PLSAssetKey]];
// [weakSelf.shortVideoEditor startEditing];
// weakSelf.playButton.selected = NO;
//
// }];
//
// [self.reverser setProcessingBlock:^(float progress) {
// NSLog(@"reverser effect, progress: %f", progress);
// dispatch_async(dispatch_get_main_queue(), ^{
// weakSelf.progressLabel.text = [NSString stringWithFormat:@"%d%%", (int)(progress * 50)];
// });
// }];
//
// [self.reverser startReversing];
//}

#pragma mark - UIActivityIndicatorView

// 加载拼接视频的动画
Expand Down

0 comments on commit 5b60a13

Please sign in to comment.