Skip to content

Commit 0056ecd

Browse files
authored
Merge pull request #88 from HeraShowFeng/v3.1.0
release version v2.2.0
2 parents dd93901 + 6e23462 commit 0056ecd

25 files changed

+481
-253
lines changed

APIDiffs/api-diffs-3.1.0.md

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# PLShortVideoKit 3.0.0 to 3.1.0 API Differences
2+
3+
## General Headers
4+
5+
`PLSComposeMediaItem`
6+
7+
- *Added* @property (assign, nonatomic) CMTimeRange timeRange;
8+
9+
`PLSTypeDefines`
10+
11+
- *Added*
12+
13+
```objc
14+
typedef enum {
15+
PLSTransitionTypeFade = 0, // 淡入淡出
16+
PLSTransitionTypeNone = 1, // 无
17+
} PLSTransitionType;
18+
```
19+
*Warning* You can only set `PLSImageVideoComposer` if the `PLSTransitionType` is `PLSTransitionTypeNone`

Example/PLShortVideoKitDemo.xcodeproj/project.pbxproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -1463,7 +1463,7 @@
14631463
"$(PROJECT_DIR)",
14641464
"$(PROJECT_DIR)/PLShortVideoKitDemo/Librarys",
14651465
);
1466-
MARKETING_VERSION = 3.0.0;
1466+
MARKETING_VERSION = 3.1.0;
14671467
PRODUCT_BUNDLE_IDENTIFIER = com.qbox.PLShortVideoKitDemo;
14681468
PRODUCT_NAME = "$(TARGET_NAME)";
14691469
};
@@ -1496,7 +1496,7 @@
14961496
"$(PROJECT_DIR)",
14971497
"$(PROJECT_DIR)/PLShortVideoKitDemo/Librarys",
14981498
);
1499-
MARKETING_VERSION = 3.0.0;
1499+
MARKETING_VERSION = 3.1.0;
15001500
PRODUCT_BUNDLE_IDENTIFIER = com.qbox.PLShortVideoKitDemo;
15011501
PRODUCT_NAME = "$(TARGET_NAME)";
15021502
};

Example/PLShortVideoKitDemo/EditViewController.m

+211-75
Large diffs are not rendered by default.

Example/PLShortVideoKitDemo/ImageVideoMixViewController.m

+37-28
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ - (void)viewDidLoad {
5959
[musicLabel sizeToFit];
6060
musicLabel.center = CGPointMake(rc.origin.x - musicLabel.bounds.size.width/2 - 5, self.transitionSwitch.center.y);
6161
[self.nextButton.superview addSubview:musicLabel];
62-
6362
}
6463

6564
- (void)viewDidDisappear:(BOOL)animated {
@@ -132,6 +131,7 @@ - (void)nextButtonClick:(UIButton *)sender {
132131
media.url = [asset movieURL];
133132
NSLog(@"Video use url");
134133
}
134+
media.timeRange = CMTimeRangeMake(kCMTimeZero, CMTimeMake(5 * 1000, 1000));
135135
[mediaItems addObject:media];
136136
} else if (PHAssetMediaTypeImage == asset.mediaType) {
137137

@@ -146,8 +146,7 @@ - (void)nextButtonClick:(UIButton *)sender {
146146
}
147147
}];
148148

149-
PLSComposeMediaItem *media = [[PLSComposeMediaItem alloc] init];
150-
149+
PLSComposeMediaItem *media = [[PLSComposeMediaItem alloc] init];
151150
media.imageDuration = MAX(3, arc4random_uniform(8));
152151
if (isGIFImage) {
153152
media.mediaType = PLSMediaTypeGIF;
@@ -185,40 +184,30 @@ - (void)nextButtonClick:(UIButton *)sender {
185184
self.imageVideoComposer.musicVolume = 1.0;
186185
self.imageVideoComposer.movieVolume = 1.0;
187186
}
187+
188+
self.imageVideoComposer.disableTransition = NO;
188189

189-
__weak typeof(self) weakSelf = self;
190+
[self showWating];
190191

192+
__weak typeof(self)weakSelf = self;
193+
191194
[self.imageVideoComposer setProcessingBlock:^(float progress) {
192195
NSLog(@"process = %f", progress);
193196
[weakSelf setProgress:progress];
194197
}];
195-
198+
196199
[self.imageVideoComposer setCompletionBlock:^(NSURL * _Nonnull url) {
197200
NSLog(@"completion");
198201
[weakSelf hideWating];
202+
weakSelf.progressLabel.text = @"";
199203

200-
// 设置音视频、水印等编辑信息
201-
NSMutableDictionary *outputSettings = [[NSMutableDictionary alloc] init];
202-
// 待编辑的原始视频素材
203-
NSMutableDictionary *plsMovieSettings = [[NSMutableDictionary alloc] init];
204-
AVAsset *asset = [AVAsset assetWithURL:url];
205-
plsMovieSettings[PLSURLKey] = url;
206-
plsMovieSettings[PLSAssetKey] = asset;
207-
plsMovieSettings[PLSStartTimeKey] = [NSNumber numberWithFloat:0.f];
208-
plsMovieSettings[PLSDurationKey] = [NSNumber numberWithFloat:CMTimeGetSeconds(asset.duration)];
209-
plsMovieSettings[PLSVolumeKey] = [NSNumber numberWithFloat:1.0f];
210-
outputSettings[PLSMovieSettingsKey] = plsMovieSettings;
211-
212-
EditViewController *videoEditViewController = [[EditViewController alloc] init];
213-
videoEditViewController.settings = outputSettings;
214-
videoEditViewController.filesURLArray = @[url];
215-
videoEditViewController.modalPresentationStyle = UIModalPresentationFullScreen;
216-
[weakSelf presentViewController:videoEditViewController animated:YES completion:nil];
217-
204+
[weakSelf joinEditViewController:url];
218205
}];
219206

220207
[self.imageVideoComposer setFailureBlock:^(NSError * _Nonnull error) {
221208
[weakSelf hideWating];
209+
weakSelf.progressLabel.text = @"";
210+
222211
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"错误" message:error.localizedDescription delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil];
223212
[alert show];
224213
}];
@@ -228,25 +217,25 @@ - (void)nextButtonClick:(UIButton *)sender {
228217
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"选择拼接模式" message:@"同步优先:优先考虑拼接之后音视频的同步性,但是可能造个各个视频的拼接处播放的时候出现音频或者视频卡顿\n流畅优先:优先考虑拼接之后播放的流畅性,各个视频的拼接处不会出现音视频卡顿现象,但是可能造成音视频不同步\n视频优先:以每一段视频数据长度来决定每一段音频数据长度\n 音频优先:以每一段音频数据长度来决定每一段视频数据长度" preferredStyle:(UIAlertControllerStyleAlert)];
229218

230219
UIAlertAction *syncAction = [UIAlertAction actionWithTitle:@"同步模式" style:(UIAlertActionStyleDefault) handler:^(UIAlertAction * _Nonnull action) {
231-
[self showWating];
220+
[weakSelf hideWating];
232221
self.imageVideoComposer.composerPriorityType = PLSComposerPriorityTypeSync;
233222
[self.imageVideoComposer startComposing];
234223
}];
235224

236225
UIAlertAction *smoothAction = [UIAlertAction actionWithTitle:@"流畅模式" style:(UIAlertActionStyleDefault) handler:^(UIAlertAction * _Nonnull action) {
237-
[self showWating];
226+
[weakSelf hideWating];
238227
self.imageVideoComposer.composerPriorityType = PLSComposerPriorityTypeSmooth;
239228
[self.imageVideoComposer startComposing];
240229
}];
241230

242231
UIAlertAction *videoAction = [UIAlertAction actionWithTitle:@"视频优先" style:(UIAlertActionStyleDefault) handler:^(UIAlertAction * _Nonnull action) {
243-
[self showWating];
232+
[weakSelf hideWating];
244233
self.imageVideoComposer.composerPriorityType = PLSComposerPriorityTypeVideo;
245234
[self.imageVideoComposer startComposing];
246235
}];
247236

248237
UIAlertAction *audioAction = [UIAlertAction actionWithTitle:@"音频优先" style:(UIAlertActionStyleDefault) handler:^(UIAlertAction * _Nonnull action) {
249-
[self showWating];
238+
[weakSelf hideWating];
250239
self.imageVideoComposer.composerPriorityType = PLSComposerPriorityTypeAudio;
251240
[self.imageVideoComposer startComposing];
252241
}];
@@ -259,11 +248,31 @@ - (void)nextButtonClick:(UIButton *)sender {
259248
[self presentViewController:alert animated:YES completion:nil];
260249

261250
} else {
262-
[self showWating];
263251
[self.imageVideoComposer startComposing];
264252
}
265253
}
266254

255+
// 进入编辑页面
256+
- (void)joinEditViewController:(NSURL *)url {
257+
// 设置音视频、水印等编辑信息
258+
NSMutableDictionary *outputSettings = [[NSMutableDictionary alloc] init];
259+
// 待编辑的原始视频素材
260+
NSMutableDictionary *plsMovieSettings = [[NSMutableDictionary alloc] init];
261+
AVAsset *asset = [AVAsset assetWithURL:url];
262+
plsMovieSettings[PLSURLKey] = url;
263+
plsMovieSettings[PLSAssetKey] = asset;
264+
plsMovieSettings[PLSStartTimeKey] = [NSNumber numberWithFloat:0.f];
265+
plsMovieSettings[PLSDurationKey] = [NSNumber numberWithFloat:CMTimeGetSeconds(asset.duration)];
266+
plsMovieSettings[PLSVolumeKey] = [NSNumber numberWithFloat:1.0f];
267+
outputSettings[PLSMovieSettingsKey] = plsMovieSettings;
268+
269+
EditViewController *videoEditViewController = [[EditViewController alloc] init];
270+
videoEditViewController.settings = outputSettings;
271+
videoEditViewController.filesURLArray = @[url];
272+
videoEditViewController.modalPresentationStyle = UIModalPresentationFullScreen;
273+
[self presentViewController:videoEditViewController animated:YES completion:nil];
274+
}
275+
267276
- (void)fetchAssetsWithMediaType:(PHAssetMediaType)mediaType {
268277
__weak __typeof(self) weak = self;
269278
dispatch_async(dispatch_get_global_queue(0, 0), ^{

Example/PLShortVideoKitDemo/Info.plist

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<key>CFBundleShortVersionString</key>
1818
<string>$(MARKETING_VERSION)</string>
1919
<key>CFBundleVersion</key>
20-
<string>$(MARKETING_VERSION).git-2019-07-25-f93b75a</string>
20+
<string>$(MARKETING_VERSION).git-2019-12-06-b5e3822</string>
2121
<key>Fabric</key>
2222
<dict>
2323
<key>APIKey</key>

Example/PLShortVideoKitDemo/MatterImportViewController.m

+1
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
116116
} else if (indexPath.row == 5) {
117117
// 导入 H.265
118118
H265MovieViewController *h265MovieViewController = [[H265MovieViewController alloc] init];
119+
h265MovieViewController.modalPresentationStyle = UIModalPresentationFullScreen;
119120
[self.navigationController pushViewController:h265MovieViewController animated:YES];
120121
}
121122

Example/PLShortVideoKitDemo/MixRecordViewController.m

-1
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,6 @@ - (void)videoMixRecorder:(PLSVideoMixRecorder *)recorder didFinishRecordingToOut
691691
self.microphoneSwitch.enabled = YES;
692692
self.sampleSwitch.enabled = YES;
693693
self.acousticEchoCancellationSwitch.enabled = YES;
694-
695694
if (self.fileEndDecoding) {
696695
[self endButtonEvent:nil];
697696
}

0 commit comments

Comments
 (0)