Skip to content

Commit

Permalink
Merge pull request #17 from depthlove/master
Browse files Browse the repository at this point in the history
release v1.4.0
  • Loading branch information
lawder authored Sep 11, 2017
2 parents e819e35 + 10f690d commit 79d989e
Show file tree
Hide file tree
Showing 56 changed files with 1,668 additions and 887 deletions.
57 changes: 57 additions & 0 deletions APIDiffs/api-diffs-1.4.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# PLShortVideoKit 1.3.0 to 1.4.0 API Differences

## General Headers

```
PLSAVAssetExportSession.h
```

- *Added* @property (assign, nonatomic) BOOL isExportMovieToPhotosAlbum;


```
PLSGifComposer.h
```

- *Added* @property (assign, nonatomic) CGFloat interval;
- *Added* - (void)cancelComposeGif;


```
PLShortVideoRecorder.h
```

- *Added* @property (readwrite, nonatomic) PLSVideoRecoderRateType recoderRate;


```
PLShortVideoTranscoder.h
```

- *Added* @property (assign, nonatomic) BOOL isExportMovieToPhotosAlbum;


```
PLSTypeDefines.h
```

- *Added* NS_ENUM(NSInteger, PLSVideoRecoderRateType)


```
Added Class PLSMovieComposer
```














8 changes: 7 additions & 1 deletion Example/PLShortVideoKitDemo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
0A398FA01ED6698F00996229 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 0A398F9D1ED6698F00996229 /* [email protected] */; };
0A3A8E8A1F208321002311A8 /* opencv2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0A3A8E891F208321002311A8 /* opencv2.framework */; };
0A4C4C8F1F3DB5F2003F63CF /* PLShortVideoKit.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 0A4C4C8E1F3DB5F2003F63CF /* PLShortVideoKit.bundle */; };
0A514AE11F62945A006A7E87 /* PLSRateButtonView.m in Sources */ = {isa = PBXBuildFile; fileRef = 0A514AE01F62945A006A7E87 /* PLSRateButtonView.m */; };
0A52C1931E9C987900561F37 /* EditViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0A52C1921E9C987900561F37 /* EditViewController.m */; };
0A57EBB41E7596CC00FC5BF8 /* record_close_normal.png in Resources */ = {isa = PBXBuildFile; fileRef = 0A57EBB31E7596CC00FC5BF8 /* record_close_normal.png */; };
0A63402A1F15C9C9005ADF6C /* MovieTransCodeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0A6340291F15C9C9005ADF6C /* MovieTransCodeViewController.m */; };
Expand Down Expand Up @@ -384,6 +385,8 @@
0A398F9D1ED6698F00996229 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "[email protected]"; path = "images/[email protected]"; sourceTree = "<group>"; };
0A3A8E891F208321002311A8 /* opencv2.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = opencv2.framework; sourceTree = "<group>"; };
0A4C4C8E1F3DB5F2003F63CF /* PLShortVideoKit.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = PLShortVideoKit.bundle; path = PLSBundleResource/PLShortVideoKit.bundle; sourceTree = "<group>"; };
0A514ADF1F62945A006A7E87 /* PLSRateButtonView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PLSRateButtonView.h; sourceTree = "<group>"; };
0A514AE01F62945A006A7E87 /* PLSRateButtonView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PLSRateButtonView.m; sourceTree = "<group>"; };
0A52C1911E9C987900561F37 /* EditViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EditViewController.h; sourceTree = "<group>"; };
0A52C1921E9C987900561F37 /* EditViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EditViewController.m; sourceTree = "<group>"; };
0A57EBB31E7596CC00FC5BF8 /* record_close_normal.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = record_close_normal.png; path = images/record_close_normal.png; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1080,6 +1083,8 @@
children = (
0ACE7C2B1ED8B072002FF4C9 /* PLSClipMovieView.h */,
0ACE7C2C1ED8B072002FF4C9 /* PLSClipMovieView.m */,
0A514ADF1F62945A006A7E87 /* PLSRateButtonView.h */,
0A514AE01F62945A006A7E87 /* PLSRateButtonView.m */,
C39EA3DE1F4EC6950007D1C3 /* PLSFormatGifView.h */,
C39EA3DF1F4EC6950007D1C3 /* PLSFormatGifView.m */,
0ACE7C2D1ED8B072002FF4C9 /* PLSDeleteButton.h */,
Expand Down Expand Up @@ -2084,7 +2089,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
B051BAB51EADFEF900385FF0 /* ShellScript */ = {
Expand Down Expand Up @@ -2156,6 +2161,7 @@
C3F91F871F1CBD4900698322 /* SDWebImageManager.m in Sources */,
0AE8AC951F063E3E006166E2 /* PLSClipAudioView.m in Sources */,
C3F91F941F1CBD4900698322 /* SSZipArchive.m in Sources */,
0A514AE11F62945A006A7E87 /* PLSRateButtonView.m in Sources */,
C3F91F4A1F1CBD4900698322 /* KWSDK_UI.m in Sources */,
C3F91F671F1CBD4900698322 /* row_common.cc in Sources */,
C3F91F4C1F1CBD4900698322 /* compare.cc in Sources */,
Expand Down
17 changes: 9 additions & 8 deletions Example/PLShortVideoKitDemo/ClipMovieViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ - (void)setupBaseToolboxView {
}

- (void)setupClipMovieView {
self.clipMovieView = [[PLSClipMovieView alloc] initWithMovieURL:self.url minDuration:2.0f maxDuration:180.f];
CGFloat duration = [self getFileDuration:self.url];
self.clipMovieView = [[PLSClipMovieView alloc] initWithMovieURL:self.url minDuration:2.0f maxDuration:duration];
self.clipMovieView.delegate = self;
[self.view addSubview:self.clipMovieView];
[self.clipMovieView mas_makeConstraints:^(MASConstraintMaker *make) {
Expand Down Expand Up @@ -169,13 +170,13 @@ - (void)nextButtonClick {

#pragma mark - PLSClipMovieView delegate
- (void)didStartDragView {
// if (self.shortVideoEditor.player.rate > 0) { // 正在播放的时候
// [self.shortVideoEditor.player pause];
// }
// if (self.shortVideoEditor.player.rate > 0) { // 正在播放的时候
// [self.shortVideoEditor.player pause];
// }
}

- (void)clipFrameView:(PLSClipMovieView *)clipFrameView didDragView:(CMTime)time {

}

- (void)clipFrameView:(PLSClipMovieView *)clipFrameView didEndDragLeftView:(CMTime)time; {
Expand All @@ -185,7 +186,7 @@ - (void)clipFrameView:(PLSClipMovieView *)clipFrameView didEndDragLeftView:(CMTi
}

- (void)clipFrameView:(PLSClipMovieView *)clipFrameView didEndDragRightView:(CMTime)time; {
self.endTime = CMTimeGetSeconds(time);
self.endTime = CMTimeGetSeconds(time);
}

- (void)clipFrameView:(PLSClipMovieView *)clipFrameView isScrolling:(BOOL)scrolling {
Expand Down Expand Up @@ -240,12 +241,12 @@ - (void)didReceiveMemoryWarning {
#pragma mark -- dealloc
- (void)dealloc {
NSLog(@"dealloc: %@", [[self class] description]);

if (self.playbackTimeCheckerTimer) {
[self.playbackTimeCheckerTimer invalidate];
self.playbackTimeCheckerTimer = nil;
}

self.baseToolboxView = nil;

self.shortVideoEditor = nil;
Expand Down
39 changes: 20 additions & 19 deletions Example/PLShortVideoKitDemo/EditViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ - (void)viewWillDisappear:(BOOL)animated {
#pragma mark -- 配置视图
- (void)setupBaseToolboxView {
self.view.backgroundColor = PLS_RGBCOLOR(25, 24, 36);

self.baseToolboxView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, PLS_SCREEN_WIDTH, 64)];
self.baseToolboxView.backgroundColor = PLS_RGBCOLOR(25, 24, 36);
[self.view addSubview:self.baseToolboxView];
Expand Down Expand Up @@ -221,7 +221,7 @@ - (void)setupEditToolboxView {
formGifButton.titleLabel.font = [UIFont systemFontOfSize:14];
[self.editToolboxView addSubview:formGifButton];
[formGifButton addTarget:self action:@selector(formatGifButtonEvent:) forControlEvents:UIControlEventTouchUpInside];


// 裁剪背景音乐
UIButton *clipMusicButton = [UIButton buttonWithType:UIButtonTypeCustom];
Expand Down Expand Up @@ -258,7 +258,7 @@ - (void)setupEditToolboxView {
[musicButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
musicButton.titleLabel.font = [UIFont systemFontOfSize:14];
[self.editToolboxView addSubview:musicButton];

// 展示音乐效果的 UICollectionView
frame = self.musicCollectionView.frame;
self.musicCollectionView.frame = CGRectMake(frame.origin.x, CGRectGetMaxY(musicButton.frame), frame.size.width, frame.size.height);
Expand Down Expand Up @@ -311,7 +311,7 @@ - (void)removeActivityIndicatorView {

[array addObject:dic];
}

return array;
}

Expand All @@ -324,7 +324,7 @@ - (NSMutableArray *)musicsArray {
NSData *data = [NSData dataWithContentsOfFile:jsonPath];
NSError *error;
NSDictionary *dicFromJson = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingAllowFragments error:&error];
// NSLog(@"load internal filters json error: %@", error);
// NSLog(@"load internal filters json error: %@", error);

NSArray *jsonArray = [dicFromJson objectForKey:@"musics"];

Expand Down Expand Up @@ -410,7 +410,7 @@ - (UIImage *)musicImageWithMusicURL:(NSURL *)url {
//artwork这个key对应的value里面存的就是封面缩略图,其它key可以取出其它摘要信息,例如title - 标题
if ([metadataItem.commonKey isEqualToString:@"artwork"]) {
data = (NSData *)metadataItem.value;

break;
}
}
Expand All @@ -435,7 +435,7 @@ - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cell
PLSEditVideoCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([PLSEditVideoCell class]) forIndexPath:indexPath];

if (collectionView == self.editVideoCollectionView) {

// 滤镜
NSDictionary *filterInfoDic = self.filtersArray[indexPath.row];

Expand All @@ -446,15 +446,15 @@ - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cell
cell.iconImageView.image = [UIImage imageWithContentsOfFile:coverImagePath];

return cell;

}
else {

NSDictionary *dic = self.musicsArray[indexPath.row];
NSString *musicName = [dic objectForKey:@"audioName"];
NSURL *musicUrl = [dic objectForKey:@"audioUrl"];
UIImage *musicImage = [self musicImageWithMusicURL:musicUrl];

cell.iconImageView.image = musicImage;
cell.iconPromptLabel.text = musicName;
}
Expand All @@ -466,7 +466,7 @@ - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cell
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {

if (collectionView == self.editVideoCollectionView) {

// 滤镜
self.filterGroup.filterIndex = indexPath.row;

Expand All @@ -481,9 +481,9 @@ - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPa
self.audioSettings[PLSStartTimeKey] = [NSNumber numberWithFloat:0.f];
self.audioSettings[PLSDurationKey] = [NSNumber numberWithFloat:0.f];
self.audioSettings[PLSNameKey] = musicName;

[self restart];

} else {

NSDictionary *dic = self.musicsArray[indexPath.row];
Expand Down Expand Up @@ -613,22 +613,23 @@ - (void)nextButtonClick {
exportSession.shouldOptimizeForNetworkUse = YES;
exportSession.outputSettings = self.outputSettings;
exportSession.delegate = self;

exportSession.isExportMovieToPhotosAlbum = YES;

[exportSession exportAsynchronously];

__weak typeof(self) weakSelf = self;

[exportSession setCompletionBlock:^(NSURL *url) {
NSLog(@"Asset Export Completed");

dispatch_async(dispatch_get_main_queue(), ^{
[weakSelf joinNextViewController:url object:weakSelf];
});
}];

[exportSession setFailureBlock:^(NSError *error) {
NSLog(@"Asset Export Failed: %@", error);

dispatch_async(dispatch_get_main_queue(), ^{
[weakSelf removeActivityIndicatorView];
});
Expand All @@ -640,11 +641,11 @@ - (void)nextButtonClick {
weakSelf.progressLabel.text = [NSString stringWithFormat:@"%d%%", (int)(progress * 100)];
}];
}

#pragma mark -- 进入 Gif 制作页面
- (void)joinGifFormatViewController {
AVAsset *asset = self.movieSettings[PLSAssetKey];

GifFormatViewController *gifFormatViewController = [[GifFormatViewController alloc] init];
gifFormatViewController.asset = asset;
[self presentViewController:gifFormatViewController animated:YES completion:nil];
Expand Down Expand Up @@ -691,10 +692,10 @@ - (BOOL)prefersStatusBarHidden {
#pragma mark -- dealloc
- (void)dealloc {
NSLog(@"dealloc: %@", [[self class] description]);

self.shortVideoEditor.player.delegate = nil;
self.shortVideoEditor.player = nil;

self.editVideoCollectionView.dataSource = nil;
self.editVideoCollectionView.delegate = nil;
self.editVideoCollectionView = nil;
Expand Down
11 changes: 6 additions & 5 deletions Example/PLShortVideoKitDemo/GifFormatViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ - (void)viewDidLoad {
// Do any additional setup after loading the view.

self.view.backgroundColor = PLS_RGBCOLOR(25, 24, 36);

[self setupBaseToolboxView];
[self setupFormatGifView];

}

#pragma mark -- 配置视图
Expand Down Expand Up @@ -111,6 +111,7 @@ - (void)formatGifView:(PLSFormatGifView *)formatGifView selectedArray:(NSArray *
- (void)formatGifView:(PLSFormatGifView *)formatGifView previewArray:(NSArray *)previewArray{
self.selectedArray = previewArray;
PLSGifComposer *gifComposer = [[PLSGifComposer alloc] initWithImagesArray:previewArray];
gifComposer.interval = 0.1;
UIImage *img = previewArray[0];

self.gifPreview = [[UIView alloc]initWithFrame:CGRectMake(0, 0, PLS_SCREEN_WIDTH, PLS_SCREEN_HEIGHT)];
Expand All @@ -136,9 +137,10 @@ - (void)backButtonClick {
#pragma mark -- 下一步
- (void)nextButtonClick {
__weak typeof(self) weakSelf = self;

PLSGifComposer *gifComposer = [[PLSGifComposer alloc] initWithImagesArray:_selectedArray];
gifComposer.gifName = nil; // 为 nil 时,SDK 内部会生成相应的唯一名称。gifComposer.gifName = @"myGif"
gifComposer.interval = 0.1;

[gifComposer setCompletionBlock:^(NSURL *url){
NSLog(@"compose Gif successed");
Expand All @@ -156,7 +158,6 @@ - (void)joinNextViewControllerWithGifUrl:(NSURL *)url imagesArray:(NSArray *)ima
PlayViewController *playViewController = [[PlayViewController alloc]init];
playViewController.actionType = PLSActionTypeGif;
playViewController.url = url;
playViewController.imagesArray = imagesArray;
[obj presentViewController:playViewController animated:YES completion:nil];
}

Expand All @@ -167,7 +168,7 @@ - (void)didReceiveMemoryWarning {

- (void)dealloc {
NSLog(@"dealloc: %@", [[self class] description]);

self.formatGifView.delegate = nil;
self.formatGifView = nil;
}
Expand Down
2 changes: 1 addition & 1 deletion Example/PLShortVideoKitDemo/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.3.0</string>
<string>1.4.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>Fabric</key>
Expand Down
Loading

0 comments on commit 79d989e

Please sign in to comment.