react-native-video-trim 5.0.5 → 5.1.0

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.
@@ -1,23 +0,0 @@
1
- #import <UIKit/UIKit.h>
2
-
3
- @interface VideoTrimmerThumb : UIView
4
-
5
- // Properties for dimensions
6
- @property (nonatomic, assign, readonly) CGFloat chevronWidth;
7
- @property (nonatomic, assign, readonly) CGFloat edgeHeight;
8
-
9
- // Grabber controls for interaction
10
- @property (nonatomic, strong, readonly) UIControl *leadingGrabber;
11
- @property (nonatomic, strong, readonly) UIControl *trailingGrabber;
12
-
13
- // UI Components (readonly access)
14
- @property (nonatomic, assign) BOOL isActive;
15
- @property (nonatomic, strong, readonly) UIImageView *leadingChevronImageView;
16
- @property (nonatomic, strong, readonly) UIImageView *trailingChevronView;
17
- @property (nonatomic, strong, readonly) UIView *wrapperView;
18
- @property (nonatomic, strong, readonly) UIView *leadingView;
19
- @property (nonatomic, strong, readonly) UIView *trailingView;
20
- @property (nonatomic, strong, readonly) UIView *topView;
21
- @property (nonatomic, strong, readonly) UIView *bottomView;
22
-
23
- @end
@@ -1,175 +0,0 @@
1
- #import "VideoTrimmerThumb.h"
2
-
3
- @interface VideoTrimmerThumb ()
4
- // Redeclare readonly properties as readwrite for internal use
5
- @property (nonatomic, strong, readwrite) UIImageView *leadingChevronImageView;
6
- @property (nonatomic, strong, readwrite) UIImageView *trailingChevronView;
7
- @property (nonatomic, strong, readwrite) UIView *wrapperView;
8
- @property (nonatomic, strong, readwrite) UIView *leadingView;
9
- @property (nonatomic, strong, readwrite) UIView *trailingView;
10
- @property (nonatomic, strong, readwrite) UIView *topView;
11
- @property (nonatomic, strong, readwrite) UIView *bottomView;
12
- @property (nonatomic, strong, readwrite) UIControl *leadingGrabber;
13
- @property (nonatomic, strong, readwrite) UIControl *trailingGrabber;
14
- @end
15
-
16
- @implementation VideoTrimmerThumb
17
-
18
- - (CGFloat)chevronWidth {
19
- return 16;
20
- }
21
-
22
- - (CGFloat)edgeHeight {
23
- return 4;
24
- }
25
-
26
- - (instancetype)initWithFrame:(CGRect)frame {
27
- if (self = [super initWithFrame:frame]) {
28
- [self setup];
29
- }
30
- return self;
31
- }
32
-
33
- - (instancetype)initWithCoder:(NSCoder *)coder {
34
- if (self = [super initWithCoder:coder]) {
35
- [self setup];
36
- }
37
- return self;
38
- }
39
-
40
- - (void)setup {
41
- // Initialize leading chevron image view
42
- self.leadingChevronImageView = [[UIImageView alloc] initWithImage:[UIImage systemImageNamed:@"chevron.compact.left"]];
43
- self.leadingChevronImageView.contentMode = UIViewContentModeScaleAspectFill;
44
- self.leadingChevronImageView.tintColor = [UIColor blackColor];
45
- self.leadingChevronImageView.tintAdjustmentMode = UIViewTintAdjustmentModeNormal;
46
- self.leadingChevronImageView.translatesAutoresizingMaskIntoConstraints = NO;
47
-
48
- // Initialize trailing chevron image view
49
- self.trailingChevronView = [[UIImageView alloc] initWithImage:[UIImage systemImageNamed:@"chevron.compact.right"]];
50
- self.trailingChevronView.contentMode = UIViewContentModeScaleAspectFill;
51
- self.trailingChevronView.tintColor = [UIColor blackColor];
52
- self.trailingChevronView.tintAdjustmentMode = UIViewTintAdjustmentModeNormal;
53
- self.trailingChevronView.translatesAutoresizingMaskIntoConstraints = NO;
54
-
55
- // Initialize wrapper view
56
- self.wrapperView = [[UIView alloc] init];
57
- self.wrapperView.translatesAutoresizingMaskIntoConstraints = NO;
58
-
59
- // Initialize leading view
60
- self.leadingView = [[UIView alloc] init];
61
- self.leadingView.layer.cornerRadius = 6;
62
- if (@available(iOS 13.0, *)) {
63
- self.leadingView.layer.cornerCurve = kCACornerCurveContinuous;
64
- }
65
- self.leadingView.layer.maskedCorners = kCALayerMinXMaxYCorner | kCALayerMinXMinYCorner;
66
- self.leadingView.translatesAutoresizingMaskIntoConstraints = NO;
67
-
68
- // Initialize trailing view
69
- self.trailingView = [[UIView alloc] init];
70
- self.trailingView.layer.cornerRadius = 6;
71
- if (@available(iOS 13.0, *)) {
72
- self.trailingView.layer.cornerCurve = kCACornerCurveContinuous;
73
- }
74
- self.trailingView.layer.maskedCorners = kCALayerMaxXMaxYCorner | kCALayerMaxXMinYCorner;
75
- self.trailingView.translatesAutoresizingMaskIntoConstraints = NO;
76
-
77
- // Initialize top view
78
- self.topView = [[UIView alloc] init];
79
- self.topView.translatesAutoresizingMaskIntoConstraints = NO;
80
-
81
- // Initialize bottom view
82
- self.bottomView = [[UIView alloc] init];
83
- self.bottomView.translatesAutoresizingMaskIntoConstraints = NO;
84
-
85
- // Initialize grabber controls
86
- self.leadingGrabber = [[UIControl alloc] init];
87
- self.leadingGrabber.translatesAutoresizingMaskIntoConstraints = NO;
88
-
89
- self.trailingGrabber = [[UIControl alloc] init];
90
- self.trailingGrabber.translatesAutoresizingMaskIntoConstraints = NO;
91
-
92
- // Set up view hierarchy
93
- [self.leadingView addSubview:self.leadingChevronImageView];
94
- [self.trailingView addSubview:self.trailingChevronView];
95
-
96
- [self.wrapperView addSubview:self.leadingView];
97
- [self.wrapperView addSubview:self.trailingView];
98
- [self.wrapperView addSubview:self.topView];
99
- [self.wrapperView addSubview:self.bottomView];
100
- [self addSubview:self.wrapperView];
101
-
102
- [self.wrapperView addSubview:self.leadingGrabber];
103
- [self.wrapperView addSubview:self.trailingGrabber];
104
-
105
- [self setupConstraints];
106
- [self updateColor];
107
- }
108
-
109
- - (void)setupConstraints {
110
- [NSLayoutConstraint activateConstraints:@[
111
- // Wrapper view constraints
112
- [self.wrapperView.topAnchor constraintEqualToAnchor:self.topAnchor],
113
- [self.wrapperView.bottomAnchor constraintEqualToAnchor:self.bottomAnchor],
114
- [self.wrapperView.leadingAnchor constraintEqualToAnchor:self.leadingAnchor],
115
- [self.wrapperView.trailingAnchor constraintEqualToAnchor:self.trailingAnchor],
116
-
117
- // Leading view constraints
118
- [self.leadingView.topAnchor constraintEqualToAnchor:self.wrapperView.topAnchor],
119
- [self.leadingView.bottomAnchor constraintEqualToAnchor:self.wrapperView.bottomAnchor],
120
- [self.leadingView.leadingAnchor constraintEqualToAnchor:self.wrapperView.leadingAnchor],
121
- [self.leadingView.widthAnchor constraintEqualToConstant:self.chevronWidth],
122
-
123
- // Trailing view constraints
124
- [self.trailingView.topAnchor constraintEqualToAnchor:self.wrapperView.topAnchor],
125
- [self.trailingView.bottomAnchor constraintEqualToAnchor:self.wrapperView.bottomAnchor],
126
- [self.trailingView.trailingAnchor constraintEqualToAnchor:self.wrapperView.trailingAnchor],
127
- [self.trailingView.widthAnchor constraintEqualToConstant:self.chevronWidth],
128
-
129
- // Top view constraints
130
- [self.topView.topAnchor constraintEqualToAnchor:self.wrapperView.topAnchor],
131
- [self.topView.leadingAnchor constraintEqualToAnchor:self.leadingView.trailingAnchor],
132
- [self.topView.trailingAnchor constraintEqualToAnchor:self.trailingView.leadingAnchor],
133
- [self.topView.heightAnchor constraintEqualToConstant:self.edgeHeight],
134
-
135
- // Bottom view constraints
136
- [self.bottomView.bottomAnchor constraintEqualToAnchor:self.wrapperView.bottomAnchor],
137
- [self.bottomView.leadingAnchor constraintEqualToAnchor:self.leadingView.trailingAnchor],
138
- [self.bottomView.trailingAnchor constraintEqualToAnchor:self.trailingView.leadingAnchor],
139
- [self.bottomView.heightAnchor constraintEqualToConstant:self.edgeHeight],
140
-
141
- // Leading Chevron ImageView constraints
142
- [self.leadingChevronImageView.topAnchor constraintEqualToAnchor:self.leadingView.topAnchor constant:8],
143
- [self.leadingChevronImageView.bottomAnchor constraintEqualToAnchor:self.leadingView.bottomAnchor constant:-8],
144
- [self.leadingChevronImageView.leadingAnchor constraintEqualToAnchor:self.leadingView.leadingAnchor constant:2],
145
- [self.leadingChevronImageView.trailingAnchor constraintEqualToAnchor:self.leadingView.trailingAnchor constant:-2],
146
-
147
- // Trailing Chevron ImageView constraints
148
- [self.trailingChevronView.topAnchor constraintEqualToAnchor:self.trailingView.topAnchor constant:8],
149
- [self.trailingChevronView.bottomAnchor constraintEqualToAnchor:self.trailingView.bottomAnchor constant:-8],
150
- [self.trailingChevronView.leadingAnchor constraintEqualToAnchor:self.trailingView.leadingAnchor constant:2],
151
- [self.trailingChevronView.trailingAnchor constraintEqualToAnchor:self.trailingView.trailingAnchor constant:-2],
152
-
153
- // Leading Grabber constraints
154
- [self.leadingGrabber.topAnchor constraintEqualToAnchor:self.leadingView.topAnchor],
155
- [self.leadingGrabber.bottomAnchor constraintEqualToAnchor:self.leadingView.bottomAnchor],
156
- [self.leadingGrabber.leadingAnchor constraintEqualToAnchor:self.leadingView.leadingAnchor],
157
- [self.leadingGrabber.trailingAnchor constraintEqualToAnchor:self.leadingView.trailingAnchor],
158
-
159
- // Trailing Grabber constraints
160
- [self.trailingGrabber.topAnchor constraintEqualToAnchor:self.trailingView.topAnchor],
161
- [self.trailingGrabber.bottomAnchor constraintEqualToAnchor:self.trailingView.bottomAnchor],
162
- [self.trailingGrabber.leadingAnchor constraintEqualToAnchor:self.trailingView.leadingAnchor],
163
- [self.trailingGrabber.trailingAnchor constraintEqualToAnchor:self.trailingView.trailingAnchor]
164
- ]];
165
- }
166
-
167
- - (void)updateColor {
168
- UIColor *color = [UIColor systemYellowColor];
169
- self.leadingView.backgroundColor = color;
170
- self.trailingView.backgroundColor = color;
171
- self.topView.backgroundColor = color;
172
- self.bottomView.backgroundColor = color;
173
- }
174
-
175
- @end
@@ -1,52 +0,0 @@
1
- #import <UIKit/UIKit.h>
2
- #import <AVFoundation/AVFoundation.h>
3
- #import <AVKit/AVKit.h>
4
- #import <VideoTrimSpec/VideoTrimSpec.h>
5
-
6
- @class VideoTrimmer;
7
-
8
- @interface VideoTrimmerViewController : UIViewController
9
-
10
- // Main properties
11
- @property (nonatomic, strong) AVAsset *asset;
12
- @property (nonatomic, copy) void (^cancelBtnClicked)(void);
13
- @property (nonatomic, copy) void (^saveBtnClicked)(CMTimeRange selectedRange);
14
-
15
- // UI Components
16
- @property (nonatomic, strong) VideoTrimmer *trimmer;
17
- @property (nonatomic, strong) UIStackView *timingStackView;
18
- @property (nonatomic, strong) UILabel *leadingTrimLabel;
19
- @property (nonatomic, strong) UILabel *currentTimeLabel;
20
- @property (nonatomic, strong) UILabel *trailingTrimLabel;
21
- @property (nonatomic, strong) UIStackView *btnStackView;
22
- @property (nonatomic, strong) UIButton *cancelBtn;
23
- @property (nonatomic, strong) UIButton *playBtn;
24
- @property (nonatomic, strong) UIActivityIndicatorView *loadingIndicator;
25
- @property (nonatomic, strong) UIButton *saveBtn;
26
- @property (nonatomic, strong) AVPlayerViewController *playerController;
27
- @property (nonatomic, strong) UIView *headerView;
28
-
29
- // Configuration properties
30
- @property (nonatomic, strong) NSString *cancelButtonText;
31
- @property (nonatomic, strong) NSString *saveButtonText;
32
- @property (nonatomic, strong) NSString *headerText;
33
- @property (nonatomic, assign) NSInteger headerTextSize;
34
- @property (nonatomic, assign) double headerTextColor;
35
- @property (nonatomic, assign) BOOL autoplay;
36
- @property (nonatomic, assign) double jumpToPositionOnLoad;
37
- @property (nonatomic, assign) BOOL enableHapticFeedback;
38
- @property (nonatomic, assign) NSInteger maximumDuration;
39
- @property (nonatomic, assign) NSInteger minimumDuration;
40
-
41
- // Player state properties
42
- @property (nonatomic, strong, readonly) AVPlayer *player;
43
- @property (nonatomic, strong) id timeObserverToken;
44
- @property (nonatomic, assign) BOOL isSeekInProgress;
45
- @property (nonatomic, assign) CMTime chaseTime;
46
-
47
- // Methods
48
- - (void)configureWithConfig:(JS::NativeVideoTrim::EditorConfig)config;
49
- - (void)onAssetFailToLoad;
50
- - (void)pausePlayer;
51
-
52
- @end