react-native-video-trim 5.0.5 → 5.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -2
- package/VideoTrim.podspec +1 -1
- package/ios/AssetLoader.swift +99 -0
- package/ios/ErrorCode.swift +17 -0
- package/ios/ProgressAlertController.swift +100 -0
- package/ios/VideoTrim-Bridging-Header.h +1 -0
- package/ios/VideoTrim.h +2 -28
- package/ios/VideoTrim.mm +156 -639
- package/ios/VideoTrim.swift +938 -0
- package/ios/VideoTrimProtocol.swift +10 -0
- package/ios/VideoTrimmer.swift +872 -0
- package/ios/VideoTrimmerThumb.swift +175 -0
- package/ios/VideoTrimmerViewController.swift +578 -0
- package/package.json +1 -1
- package/ios/AssetLoader.h +0 -19
- package/ios/AssetLoader.mm +0 -87
- package/ios/ErrorCode.h +0 -9
- package/ios/ProgressAlertController.h +0 -12
- package/ios/ProgressAlertController.mm +0 -106
- package/ios/VideoTrimmer.h +0 -67
- package/ios/VideoTrimmer.mm +0 -863
- package/ios/VideoTrimmerThumb.h +0 -23
- package/ios/VideoTrimmerThumb.mm +0 -175
- package/ios/VideoTrimmerViewController.h +0 -52
- package/ios/VideoTrimmerViewController.mm +0 -533
package/ios/ErrorCode.h
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
#import <UIKit/UIKit.h>
|
|
2
|
-
|
|
3
|
-
@interface ProgressAlertController : UIViewController
|
|
4
|
-
|
|
5
|
-
@property (nonatomic, copy) void (^onDismiss)(void);
|
|
6
|
-
|
|
7
|
-
- (void)setTitle:(NSString *)text;
|
|
8
|
-
- (void)setCancelTitle:(NSString *)text;
|
|
9
|
-
- (void)setProgress:(float)progress;
|
|
10
|
-
- (void)showCancelBtn;
|
|
11
|
-
|
|
12
|
-
@end
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
#import "ProgressAlertController.h"
|
|
2
|
-
|
|
3
|
-
@interface ProgressAlertController ()
|
|
4
|
-
|
|
5
|
-
@property (nonatomic, strong) UILabel *titleLabel;
|
|
6
|
-
@property (nonatomic, strong) UIProgressView *progressBar;
|
|
7
|
-
@property (nonatomic, strong) UIButton *actionButton;
|
|
8
|
-
|
|
9
|
-
@end
|
|
10
|
-
|
|
11
|
-
@implementation ProgressAlertController
|
|
12
|
-
|
|
13
|
-
- (instancetype)init {
|
|
14
|
-
// init early because in VideoTrim.mm we call this before presenting the view controller (before viewDidLoad)
|
|
15
|
-
if (self = [super init]) {
|
|
16
|
-
self.titleLabel = [[UILabel alloc] init];
|
|
17
|
-
self.progressBar = [[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleDefault];
|
|
18
|
-
self.actionButton = [UIButton buttonWithType:UIButtonTypeSystem];
|
|
19
|
-
}
|
|
20
|
-
return self;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
- (void)viewDidLoad {
|
|
24
|
-
[super viewDidLoad];
|
|
25
|
-
[self setupBackground];
|
|
26
|
-
[self setupAlertView];
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
- (void)setupBackground {
|
|
30
|
-
self.view.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.4];
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
- (void)setupAlertView {
|
|
34
|
-
UIView *alertView = [[UIView alloc] init];
|
|
35
|
-
alertView.backgroundColor = [UIColor colorWithRed:28.0/255.0 green:28.0/255.0 blue:30.0/255.0 alpha:1.0];
|
|
36
|
-
alertView.layer.cornerRadius = 12;
|
|
37
|
-
alertView.translatesAutoresizingMaskIntoConstraints = NO;
|
|
38
|
-
[self.view addSubview:alertView];
|
|
39
|
-
|
|
40
|
-
// AlertView Constraints
|
|
41
|
-
[NSLayoutConstraint activateConstraints:@[
|
|
42
|
-
[alertView.centerXAnchor constraintEqualToAnchor:self.view.centerXAnchor],
|
|
43
|
-
[alertView.centerYAnchor constraintEqualToAnchor:self.view.centerYAnchor],
|
|
44
|
-
[alertView.widthAnchor constraintEqualToConstant:270]
|
|
45
|
-
]];
|
|
46
|
-
|
|
47
|
-
// Title Label
|
|
48
|
-
self.titleLabel.translatesAutoresizingMaskIntoConstraints = NO;
|
|
49
|
-
self.titleLabel.textAlignment = NSTextAlignmentCenter;
|
|
50
|
-
self.titleLabel.font = [UIFont systemFontOfSize:18];
|
|
51
|
-
self.titleLabel.numberOfLines = 0;
|
|
52
|
-
self.titleLabel.textColor = [UIColor whiteColor];
|
|
53
|
-
[alertView addSubview:self.titleLabel];
|
|
54
|
-
|
|
55
|
-
// Progress Bar
|
|
56
|
-
self.progressBar.translatesAutoresizingMaskIntoConstraints = NO;
|
|
57
|
-
[alertView addSubview:self.progressBar];
|
|
58
|
-
|
|
59
|
-
// Action Button
|
|
60
|
-
|
|
61
|
-
[self.actionButton setTitle:@"Cancel" forState:UIControlStateNormal];
|
|
62
|
-
[self.actionButton setTitleColor:[UIColor systemPinkColor] forState:UIControlStateNormal];
|
|
63
|
-
self.actionButton.titleLabel.font = [UIFont systemFontOfSize:16];
|
|
64
|
-
[self.actionButton addTarget:self action:@selector(dismissAlert) forControlEvents:UIControlEventTouchUpInside];
|
|
65
|
-
self.actionButton.translatesAutoresizingMaskIntoConstraints = NO;
|
|
66
|
-
self.actionButton.hidden = YES;
|
|
67
|
-
[alertView addSubview:self.actionButton];
|
|
68
|
-
|
|
69
|
-
// Constraints for titleLabel, progressBar, and actionButton
|
|
70
|
-
[NSLayoutConstraint activateConstraints:@[
|
|
71
|
-
[self.titleLabel.topAnchor constraintEqualToAnchor:alertView.topAnchor constant:16],
|
|
72
|
-
[self.titleLabel.leadingAnchor constraintEqualToAnchor:alertView.leadingAnchor constant:16],
|
|
73
|
-
[self.titleLabel.trailingAnchor constraintEqualToAnchor:alertView.trailingAnchor constant:-16],
|
|
74
|
-
|
|
75
|
-
[self.progressBar.topAnchor constraintEqualToAnchor:self.titleLabel.bottomAnchor constant:16],
|
|
76
|
-
[self.progressBar.leadingAnchor constraintEqualToAnchor:alertView.leadingAnchor constant:16],
|
|
77
|
-
[self.progressBar.trailingAnchor constraintEqualToAnchor:alertView.trailingAnchor constant:-16],
|
|
78
|
-
|
|
79
|
-
[self.actionButton.topAnchor constraintEqualToAnchor:self.progressBar.bottomAnchor constant:16],
|
|
80
|
-
[self.actionButton.bottomAnchor constraintEqualToAnchor:alertView.bottomAnchor constant:-16],
|
|
81
|
-
[self.actionButton.centerXAnchor constraintEqualToAnchor:alertView.centerXAnchor]
|
|
82
|
-
]];
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
- (void)dismissAlert {
|
|
86
|
-
if (self.onDismiss) self.onDismiss();
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
- (void)setTitle:(NSString *)text {
|
|
90
|
-
self.titleLabel.text = text;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
- (void)setCancelTitle:(NSString *)text {
|
|
94
|
-
[self.actionButton setTitle:text forState:UIControlStateNormal];
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
- (void)setProgress:(float)progress {
|
|
98
|
-
[self.progressBar setProgress:progress animated:YES];
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
- (void)showCancelBtn {
|
|
102
|
-
[self.view layoutIfNeeded];
|
|
103
|
-
self.actionButton.hidden = NO;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
@end
|
package/ios/VideoTrimmer.h
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
#import <UIKit/UIKit.h>
|
|
2
|
-
#import <AVFoundation/AVFoundation.h>
|
|
3
|
-
|
|
4
|
-
@class VideoTrimmerThumb;
|
|
5
|
-
|
|
6
|
-
typedef NS_ENUM(NSInteger, VideoTrimmerProgressIndicatorMode) {
|
|
7
|
-
VideoTrimmerProgressIndicatorModeHiddenOnlyWhenTrimming,
|
|
8
|
-
VideoTrimmerProgressIndicatorModeAlwaysShown,
|
|
9
|
-
VideoTrimmerProgressIndicatorModeAlwaysHidden
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
typedef NS_ENUM(NSInteger, VideoTrimmerTrimmingState) {
|
|
13
|
-
VideoTrimmerTrimmingStateNone,
|
|
14
|
-
VideoTrimmerTrimmingStateLeading,
|
|
15
|
-
VideoTrimmerTrimmingStateTrailing
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
@interface VideoTrimmer : UIControl
|
|
19
|
-
|
|
20
|
-
// Main properties
|
|
21
|
-
@property (nonatomic, strong) AVAsset *asset;
|
|
22
|
-
@property (nonatomic, strong) AVVideoComposition *videoComposition;
|
|
23
|
-
@property (nonatomic, assign) CMTime minimumDuration;
|
|
24
|
-
@property (nonatomic, assign) CMTime maximumDuration;
|
|
25
|
-
@property (nonatomic, assign) BOOL enableHapticFeedback;
|
|
26
|
-
|
|
27
|
-
// Range properties
|
|
28
|
-
@property (nonatomic, assign, readonly) CMTimeRange range;
|
|
29
|
-
@property (nonatomic, assign) CMTimeRange selectedRange;
|
|
30
|
-
|
|
31
|
-
// Progress properties
|
|
32
|
-
@property (nonatomic, assign) VideoTrimmerProgressIndicatorMode progressIndicatorMode;
|
|
33
|
-
@property (nonatomic, assign) CMTime progress;
|
|
34
|
-
|
|
35
|
-
// State properties (read-only)
|
|
36
|
-
@property (nonatomic, assign, readonly) VideoTrimmerTrimmingState trimmingState;
|
|
37
|
-
@property (nonatomic, assign, readonly) BOOL isZoomedIn;
|
|
38
|
-
@property (nonatomic, assign, readonly) CMTimeRange zoomedInRange;
|
|
39
|
-
@property (nonatomic, assign, readonly) BOOL isScrubbing;
|
|
40
|
-
|
|
41
|
-
// Computed properties
|
|
42
|
-
@property (nonatomic, assign, readonly) CMTimeRange visibleRange;
|
|
43
|
-
@property (nonatomic, assign, readonly) CMTime selectedTime;
|
|
44
|
-
|
|
45
|
-
// Style properties
|
|
46
|
-
@property (nonatomic, assign) CGFloat horizontalInset;
|
|
47
|
-
@property (nonatomic, strong) UIColor *trackBackgroundColor;
|
|
48
|
-
@property (nonatomic, strong) UIColor *thumbRestColor;
|
|
49
|
-
|
|
50
|
-
// Gesture recognizers (read-only)
|
|
51
|
-
@property (nonatomic, strong, readonly) UILongPressGestureRecognizer *leadingGestureRecognizer;
|
|
52
|
-
@property (nonatomic, strong, readonly) UILongPressGestureRecognizer *trailingGestureRecognizer;
|
|
53
|
-
@property (nonatomic, strong, readonly) UILongPressGestureRecognizer *progressGestureRecognizer;
|
|
54
|
-
@property (nonatomic, strong, readonly) UILongPressGestureRecognizer *thumbnailInteractionGestureRecognizer;
|
|
55
|
-
|
|
56
|
-
// Custom events
|
|
57
|
-
+ (UIControlEvents)didBeginTrimmingFromStart;
|
|
58
|
-
+ (UIControlEvents)leadingGrabberChanged;
|
|
59
|
-
+ (UIControlEvents)didEndTrimmingFromStart;
|
|
60
|
-
+ (UIControlEvents)didBeginTrimmingFromEnd;
|
|
61
|
-
+ (UIControlEvents)trailingGrabberChanged;
|
|
62
|
-
+ (UIControlEvents)didEndTrimmingFromEnd;
|
|
63
|
-
+ (UIControlEvents)didBeginScrubbing;
|
|
64
|
-
+ (UIControlEvents)progressChanged;
|
|
65
|
-
+ (UIControlEvents)didEndScrubbing;
|
|
66
|
-
|
|
67
|
-
@end
|