Skip to content

Commit

Permalink
update TuTu demo
Browse files Browse the repository at this point in the history
  • Loading branch information
anhaoxiong committed Mar 29, 2019
1 parent 1cdc0b4 commit 184449b
Show file tree
Hide file tree
Showing 8 changed files with 479 additions and 127 deletions.
6 changes: 6 additions & 0 deletions Example_TuTu/PLShortVideoKitDemo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@
9343A8C01F66763A007213BD /* Time_Machine_No_Reverser.png in Resources */ = {isa = PBXBuildFile; fileRef = 9343A8BE1F66763A007213BD /* Time_Machine_No_Reverser.png */; };
9343A8C11F66763A007213BD /* Time_Machine_Reverser.png in Resources */ = {isa = PBXBuildFile; fileRef = 9343A8BF1F66763A007213BD /* Time_Machine_Reverser.png */; };
BC490FDD21B161B700959C8A /* ImageVideoMixViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BC490FDC21B161B700959C8A /* ImageVideoMixViewController.m */; };
BC8DD6C6224E340400E05B26 /* PLScreenRecorderManager.m in Sources */ = {isa = PBXBuildFile; fileRef = BC8DD6C4224E340400E05B26 /* PLScreenRecorderManager.m */; };
BCA3CEC221B16C8F009F25B5 /* mulitRate.png in Resources */ = {isa = PBXBuildFile; fileRef = BCA3CEC021B16C8F009F25B5 /* mulitRate.png */; };
BCA3CEC421B16D06009F25B5 /* watermark.gif in Resources */ = {isa = PBXBuildFile; fileRef = BCA3CEC321B16D06009F25B5 /* watermark.gif */; };
BCA3CF5A21B22154009F25B5 /* TuSDK.bundle in Resources */ = {isa = PBXBuildFile; fileRef = BCA3CEC821B22153009F25B5 /* TuSDK.bundle */; };
Expand Down Expand Up @@ -662,6 +663,8 @@
9343A8BF1F66763A007213BD /* Time_Machine_Reverser.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Time_Machine_Reverser.png; path = images/Time_Machine_Reverser.png; sourceTree = "<group>"; };
BC490FDA21B161B700959C8A /* ImageVideoMixViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageVideoMixViewController.h; sourceTree = "<group>"; };
BC490FDC21B161B700959C8A /* ImageVideoMixViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ImageVideoMixViewController.m; sourceTree = "<group>"; };
BC8DD6C4224E340400E05B26 /* PLScreenRecorderManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PLScreenRecorderManager.m; sourceTree = "<group>"; };
BC8DD6C5224E340400E05B26 /* PLScreenRecorderManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PLScreenRecorderManager.h; sourceTree = "<group>"; };
BCA3CEC021B16C8F009F25B5 /* mulitRate.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = mulitRate.png; path = images/mulitRate.png; sourceTree = "<group>"; };
BCA3CEC321B16D06009F25B5 /* watermark.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = watermark.gif; sourceTree = "<group>"; };
BCA3CEC821B22153009F25B5 /* TuSDK.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = TuSDK.bundle; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1207,6 +1210,8 @@
0A6340301F15E8CC005ADF6C /* PLSSelectionView.m */,
0A534EA8200E27F00032A981 /* PLSViewRecorderManager.h */,
0A534EAA200E27F10032A981 /* PLSViewRecorderManager.m */,
BC8DD6C5224E340400E05B26 /* PLScreenRecorderManager.h */,
BC8DD6C4224E340400E05B26 /* PLScreenRecorderManager.m */,
);
path = "UI+Tools";
sourceTree = "<group>";
Expand Down Expand Up @@ -1997,6 +2002,7 @@
764FD4302112CE8B00CF1F0C /* SPARUtil.m in Sources */,
BCA3CFBB21B22154009F25B5 /* EffectsView.m in Sources */,
BCA3CFAC21B22154009F25B5 /* StickerPanelView.m in Sources */,
BC8DD6C6224E340400E05B26 /* PLScreenRecorderManager.m in Sources */,
0A928BE31EE75703007D2250 /* PLSAudioVolumeView.m in Sources */,
7697482C202835D2001AC847 /* TransitionViewController.m in Sources */,
BCA3CFB921B22154009F25B5 /* OnlineStickerGroup.m in Sources */,
Expand Down
19 changes: 15 additions & 4 deletions Example_TuTu/PLShortVideoKitDemo/EditViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -1219,6 +1219,9 @@ - (void)addMVLayerWithColor:(NSURL *)colorURL alpha:(NSURL *)alphaURL {
}

[self.shortVideoEditor addMVLayerWithColor:self.colorURL alpha:self.alphaURL timeRange:kCMTimeRangeZero loopEnable:YES];
if (![self.shortVideoEditor isEditing]) {
[self.shortVideoEditor startEditing];
}
}

- (void)addFilter:(NSString *)colorImagePath {
Expand Down Expand Up @@ -2343,7 +2346,9 @@ - (void)nextButtonClick {
}

// 添加背景音乐信息
[self.audioSettingsArray insertObject:self.backgroundAudioSettings atIndex:0];
if (self.backgroundAudioSettings[PLSURLKey] && ![self.audioSettingsArray containsObject:self.backgroundAudioSettings]) {
[self.audioSettingsArray insertObject:self.backgroundAudioSettings atIndex:0];
}

AVAsset *asset = self.movieSettings[PLSAssetKey];
PLSAVAssetExportSession *exportSession = [[PLSAVAssetExportSession alloc] initWithAsset:asset];
Expand All @@ -2365,8 +2370,12 @@ - (void)nextButtonClick {

// 旋转视频
exportSession.videoLayerOrientation = self.videoLayerOrientation;
[exportSession addFilter:self.colorImagePath];
[exportSession addMVLayerWithColor:self.colorURL alpha:self.alphaURL timeRange:kCMTimeRangeZero loopEnable:YES];
if (self.colorImagePath) {
[exportSession addFilter:self.colorImagePath];
}
if (self.colorURL && self.alphaURL) {
[exportSession addMVLayerWithColor:self.colorURL alpha:self.alphaURL timeRange:kCMTimeRangeZero loopEnable:YES];
}

__weak typeof(self) weakSelf = self;
[exportSession setCompletionBlock:^(NSURL *url) {
Expand Down Expand Up @@ -2397,7 +2406,9 @@ - (void)nextButtonClick {
[exportSession setProcessingBlock:^(float progress) {
// 更新进度 UI
NSLog(@"Asset Export Progress: %f", progress);
weakSelf.progressLabel.text = [NSString stringWithFormat:@"%d%%", (int)(progress * 100)];
dispatch_async(dispatch_get_main_queue(), ^{
weakSelf.progressLabel.text = [NSString stringWithFormat:@"%d%%", (int)(progress * 100)];
});
}];

[exportSession exportAsynchronously];
Expand Down
4 changes: 2 additions & 2 deletions Example_TuTu/PLShortVideoKitDemo/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.16.1</string>
<string>2.0.0</string>
<key>CFBundleVersion</key>
<string>1.16.1.git-2019-01-28-1f597d9</string>
<string>2.0.0.git-2019-03-29-1cdc0b4</string>
<key>Fabric</key>
<dict>
<key>APIKey</key>
Expand Down
Binary file modified Example_TuTu/PLShortVideoKitDemo/Librarys/libMuseProcessor.a
Binary file not shown.
Loading

0 comments on commit 184449b

Please sign in to comment.