Skip to content

Commit c6ecc28

Browse files
committed
Add version 2.15.0
1 parent f444a82 commit c6ecc28

6 files changed

+83
-54
lines changed

CHANGELOG.md

+12
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
## [2.15.0]
2+
3+
### Changed
4+
5+
* 🚨 Bumped iOS deployment target to 13.0.
6+
* [react-native-videoeditorsdk] Raised minimum VideoEditor SDK for iOS version to 11.1.0. See the [changelog](https://github.com/imgly/vesdk-ios-build/blob/master/CHANGELOG.md) for more information.
7+
* [react-native-photoeditorsdk] Raised minimum PhotoEditor SDK for iOS version to 11.1.0. See the [changelog](https://github.com/imgly/pesdk-ios-build/blob/master/CHANGELOG.md) for more information.
8+
9+
### Added
10+
11+
* Added implementation and documentation for background removal.
12+
113
## [2.14.0]
214

315
### Added

README.md

+10-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@
1919

2020
Check out our [video tutorial](https://img.ly/blog/a-photo-and-video-editor-for-your-react-native-apps/) for a step-by-step integration guide which also details advanced SDK features, such as serializing and reusing previously applied editing operations.
2121

22+
## System requirements
23+
24+
- React Native: 0.60
25+
- iOS: 13
26+
- Android: 5 (SDK 21)
27+
2228
## Getting started
2329

2430
### Known Issues
@@ -100,7 +106,9 @@ In order to use this module with the Expo CLI you can make use of our integrated
100106

101107
**Please note that the `react-native-imglysdk` module manages both VideoEditor SDK as well as PhotoEditor SDK so you only need to add the Expo config plugin once even when using both SDKs.**
102108

103-
3. The changes will be applied on `expo prebuild` or during the prebuild phase of `eas build`.
109+
3. From version `2.15.0` the iOS deployment target needs to be set to at least iOS 13. You can use the `expo-build-properties` config plugin for this. Please refer to the [official Expo docs](https://docs.expo.dev/versions/v45.0.0/sdk/build-properties/).
110+
111+
4. The changes will be applied on `expo prebuild` or during the prebuild phase of `eas build`.
104112

105113
For further information on how to integrate Expo config plugins please also refer to the official [docs](https://docs.expo.dev/guides/config-plugins/#using-a-plugin-in-your-app).
106114

@@ -219,6 +227,7 @@ For older React Native versions autolinking is not available and VideoEditor SDK
219227
220228
include 'backend:sticker-animated'
221229
include 'backend:sticker-smart'
230+
include 'backend:background-removal'
222231
}
223232
}
224233
```

RNVideoEditorSDK.podspec

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ Pod::Spec.new do |s|
1010
s.homepage = package['homepage']
1111
s.license = { :type => package['license'], :file => package['licenseFilename'] }
1212
s.author = { package['author']['name'] => package['author']['email'] }
13-
s.platform = :ios, '9.0'
13+
s.platform = :ios, '13.0'
1414
s.source = { :git => package['repository']['url'], :tag => "#{s.version}" }
1515
s.source_files = 'ios/**/*.{h,m,swift}'
1616
s.public_header_files = ['ios/RNVideoEditorSDK.h', 'ios/RNImglyKit.h']
1717
s.requires_arc = true
1818

1919
s.dependency 'React'
2020
s.dependency 'React-RCTImage'
21-
s.dependency 'VideoEditorSDK', '~> 10.30'
21+
s.dependency 'VideoEditorSDK', '~> 11.1'
2222
end

configuration.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,13 @@ export interface Configuration {
2727
/**
2828
* Defines all allowed actions for the main screen that are displayed as overlay buttons on the canvas.
2929
* Only buttons for allowed actions are visible.
30+
* @note The `CanvasAction.REMOVE_BACKGROUND` action is only shown when editing photos where a person could be detected. This feature is only supported on devices running iOS 15+.
3031
* @note The `CanvasAction.SOUND_ON_OFF` and `CanvasAction.PLAY_PAUSE` action is only shown when editing videos.
3132
* @example // Defaults to:
3233
* [CanvasAction.SOUND_ON_OFF, CanvasAction.PLAY_PAUSE, CanvasAction.UNDO, CanvasAction.REDO]
3334
*/
3435
mainCanvasActions?: Array<
36+
CanvasAction.REMOVE_BACKGROUND |
3537
CanvasAction.SOUND_ON_OFF |
3638
CanvasAction.PLAY_PAUSE |
3739
CanvasAction.UNDO |
@@ -603,8 +605,9 @@ export interface Configuration {
603605
colors?: ColorPalette;
604606
/**
605607
* Defines all allowed actions for the sticker tool menu. Only buttons for allowed actions are visible and shown in the given order.
608+
* @note The `StickerAction.REMOVE_BACKGROUND` action is only shown for personal and external (non-animated) stickers where a person could be detected. This feature is only supported on devices running iOS 15+.
606609
* @example // Defaults to:
607-
* [StickerAction.REPLACE, StickerAction.OPACITY, StickerAction.COLOR]
610+
* [StickerAction.REPLACE, StickerAction.OPACITY, StickerAction.COLOR, StickerAction.REMOVE_BACKGROUND]
608611
*/
609612
actions?: StickerAction[];
610613
/**
@@ -1297,6 +1300,7 @@ export enum CanvasAction {
12971300
INVERT = "invert",
12981301
SOUND_ON_OFF = "soundonoff",
12991302
PLAY_PAUSE = "playpause",
1303+
REMOVE_BACKGROUND = "removebackground",
13001304
}
13011305

13021306
/** A sticker action. */
@@ -1308,6 +1312,7 @@ export enum StickerAction {
13081312
SATURATION = "saturation",
13091313
REPLACE = "replace",
13101314
OPACITY = "opacity",
1315+
REMOVE_BACKGROUND = "removebackground",
13111316
}
13121317

13131318
/** A text action. */

ios/RNVideoEditorSDK.m

+51-48
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ + (void)setWillPresentVideoEditViewController:(RNVESDKWillPresentBlock)willPrese
2929
_willPresentVideoEditViewController = willPresentBlock;
3030
}
3131

32+
- (void)handleError:(nonnull PESDKVideoEditViewController *)videoEditViewController code:(nullable NSString *)code message:(nullable NSString *)message error:(nullable NSError *)error {
33+
RCTPromiseRejectBlock reject = self.reject;
34+
[self dismiss:videoEditViewController animated:YES completion:^{
35+
reject(code, message, error);
36+
}];
37+
}
38+
3239
- (void)present:(nonnull PESDKVideo *)video withConfiguration:(nullable NSDictionary *)dictionary andSerialization:(nullable NSDictionary *)state
3340
resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject
3441
{
@@ -113,49 +120,49 @@ - (void)present:(nonnull PESDKVideo *)video withConfiguration:(nullable NSDictio
113120
resolve:(RCTPromiseResolveBlock)resolve
114121
reject:(RCTPromiseRejectBlock)reject)
115122
{
116-
NSMutableArray<AVAsset *> *assets = [NSMutableArray new];
117-
118-
if (requests.count > 0) {
119-
for (NSURLRequest *request in requests) {
120-
if (request.URL.isFileURL) {
121-
if (![[NSFileManager defaultManager] fileExistsAtPath:request.URL.path]) {
122-
reject(RN_IMGLY.kErrorUnableToLoad, @"File does not exist", nil);
123-
return;
124-
}
125-
}
126-
127-
AVAsset *asset = [AVAsset assetWithURL:request.URL];
128-
[assets addObject:asset];
123+
NSMutableArray<AVAsset *> *assets = [NSMutableArray new];
124+
125+
if (requests.count > 0) {
126+
for (NSURLRequest *request in requests) {
127+
if (request.URL.isFileURL) {
128+
if (![[NSFileManager defaultManager] fileExistsAtPath:request.URL.path]) {
129+
reject(RN_IMGLY.kErrorUnableToLoad, @"File does not exist", nil);
130+
return;
129131
}
132+
}
133+
134+
AVAsset *asset = [AVAsset assetWithURL:request.URL];
135+
[assets addObject:asset];
130136
}
137+
}
131138

132-
PESDKVideo *video;
139+
PESDKVideo *video;
133140

134-
if (CGSizeEqualToSize(videoSize, CGSizeZero)) {
135-
if (assets.count == 0) {
136-
RCTLogError(@"A video without assets must have a specific size.");
137-
reject(RN_IMGLY.kErrorUnableToLoad, @"The editor requires a valid size when initialized without a video.", nil);
138-
return;
139-
}
140-
video = [[PESDKVideo alloc] initWithAssets:assets];
141-
} else {
142-
if (videoSize.height <= 0 || videoSize.width <= 0) {
143-
RCTLogError(@"Invalid video size: width and height must be greater than zero");
144-
reject(RN_IMGLY.kErrorUnableToLoad, @"Invalid video size: width and height must be greater than zero", nil);
145-
return;
146-
}
147-
if (assets.count == 0) {
148-
video = [[PESDKVideo alloc] initWithSize:videoSize];
149-
}
150-
video = [[PESDKVideo alloc] initWithAssets:assets size:videoSize];
141+
if (CGSizeEqualToSize(videoSize, CGSizeZero)) {
142+
if (assets.count == 0) {
143+
RCTLogError(@"A video without assets must have a specific size.");
144+
reject(RN_IMGLY.kErrorUnableToLoad, @"The editor requires a valid size when initialized without a video.", nil);
145+
return;
146+
}
147+
video = [[PESDKVideo alloc] initWithAssets:assets];
148+
} else {
149+
if (videoSize.height <= 0 || videoSize.width <= 0) {
150+
RCTLogError(@"Invalid video size: width and height must be greater than zero");
151+
reject(RN_IMGLY.kErrorUnableToLoad, @"Invalid video size: width and height must be greater than zero", nil);
152+
return;
153+
}
154+
if (assets.count == 0) {
155+
video = [[PESDKVideo alloc] initWithSize:videoSize];
151156
}
157+
video = [[PESDKVideo alloc] initWithAssets:assets size:videoSize];
158+
}
152159

153-
[self present:video withConfiguration:configuration andSerialization:state resolve:resolve reject:reject];
160+
[self present:video withConfiguration:configuration andSerialization:state resolve:resolve reject:reject];
154161
}
155162

156163
#pragma mark - PESDKVideoEditViewControllerDelegate
157164

158-
- (void)videoEditViewController:(nonnull PESDKVideoEditViewController *)videoEditViewController didFinishWithVideoAtURL:(nullable NSURL *)url {
165+
- (void)videoEditViewControllerDidFinish:(nonnull PESDKVideoEditViewController *)videoEditViewController result:(nonnull PESDKVideoEditorResult *)result {
159166
NSError *error = nil;
160167
id serialization = nil;
161168

@@ -171,17 +178,16 @@ - (void)videoEditViewController:(nonnull PESDKVideoEditViewController *)videoEdi
171178
}
172179
}
173180

174-
RCTPromiseResolveBlock resolve = self.resolve;
175-
RCTPromiseRejectBlock reject = self.reject;
176-
[self dismiss:videoEditViewController animated:YES completion:^{
177-
if (error == nil) {
178-
resolve(@{ @"video": (url != nil) ? url.absoluteString : [NSNull null],
179-
@"hasChanges": @(videoEditViewController.hasChanges),
181+
if (error == nil) {
182+
RCTPromiseResolveBlock resolve = self.resolve;
183+
[self dismiss:videoEditViewController animated:YES completion:^{
184+
resolve(@{ @"video": (result.output.url != nil) ? result.output.url.absoluteString : [NSNull null],
185+
@"hasChanges": @(result.status == VESDKVideoEditorStatusRenderedWithChanges),
180186
@"serialization": (serialization != nil) ? serialization : [NSNull null] });
181-
} else {
182-
reject(RN_IMGLY.kErrorUnableToExport, [NSString RN_IMGLY_string:@"Unable to export video or serialization." withError:error], error);
183-
}
184-
}];
187+
}];
188+
} else {
189+
[self handleError:videoEditViewController code:RN_IMGLY.kErrorUnableToExport message:[NSString RN_IMGLY_string:@"Unable to export video or serialization." withError:error] error:error];
190+
}
185191
}
186192

187193
- (void)videoEditViewControllerDidCancel:(nonnull PESDKVideoEditViewController *)videoEditViewController {
@@ -191,11 +197,8 @@ - (void)videoEditViewControllerDidCancel:(nonnull PESDKVideoEditViewController *
191197
}];
192198
}
193199

194-
- (void)videoEditViewControllerDidFailToGenerateVideo:(nonnull PESDKVideoEditViewController *)videoEditViewController {
195-
RCTPromiseRejectBlock reject = self.reject;
196-
[self dismiss:videoEditViewController animated:YES completion:^{
197-
reject(RN_IMGLY.kErrorUnableToExport, @"Unable to generate video", nil);
198-
}];
200+
- (void)videoEditViewControllerDidFail:(nonnull PESDKVideoEditViewController *)videoEditViewController error:(PESDKVideoEditorError *)error {
201+
[self handleError:videoEditViewController code:RN_IMGLY.kErrorUnableToExport message:@"Unable to generate video" error:error];
199202
}
200203

201204
@end

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "react-native-videoeditorsdk",
33
"title": "React Native module for VideoEditor SDK",
4-
"version": "2.14.0",
4+
"version": "2.15.0",
55
"description": "A React Native module for VideoEditor SDK. Integrate the video editor into your own HTML5, iOS or Android app - in minutes!",
66
"main": "index.js",
77
"typings": "index.d.ts",
@@ -35,6 +35,6 @@
3535
"react-native": ">=0.60.0 <1.0.x"
3636
},
3737
"dependencies": {
38-
"react-native-imglysdk": "2.14.0"
38+
"react-native-imglysdk": "2.15.0"
3939
}
4040
}

0 commit comments

Comments
 (0)