Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"build:ios": "cd ios && xcodebuild -workspace VeSdkReactNativeV2Example.xcworkspace -scheme VeSdkReactNativeV2Example -configuration Debug -sdk iphonesimulator CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ GCC_OPTIMIZATION_LEVEL=0 GCC_PRECOMPILE_PREFIX_HEADER=YES ASSETCATALOG_COMPILER_OPTIMIZATION=time DEBUG_INFORMATION_FORMAT=dwarf COMPILER_INDEX_STORE_ENABLE=NO"
},
"dependencies": {
"pe-sdk-react-native": "^0.0.1",
"react": "18.2.0",
"react-native": "0.74.2",
"react-native-image-picker": "^7.1.2"
Expand Down
30 changes: 29 additions & 1 deletion example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import VideoEditorPlugin, {
WatermarkAlignment,
} from 'video-editor-react-native';

import PhotoEditorPlugin from 'pe-sdk-react-native';

import { launchImageLibrary } from 'react-native-image-picker';

const LICENSE_TOKEN = SET BANUBA LICENSE TOKEN
Expand All @@ -30,6 +32,7 @@ export default class App extends Component {
// Specify your Config params in the builder below
//.setAudioBrowser(...)
//...
.setProcessPictureExternally(true)
.build();

// Export Data example
Expand Down Expand Up @@ -58,14 +61,37 @@ export default class App extends Component {
};
}

handleVideoExport(response) {
handleVideoExport = async(response) => {
let exportedVideoSources = response?.exportedVideoSources
let exportedPreview = response?.exportedPreview
let exportedMeta = response?.exportedMeta
console.log('Export completed successfully: video = ' + exportedVideoSources + '; videoPreview = '
+ exportedPreview + "; meta = " + exportedMeta);

// exportedVideoSource is an empty Array in case of exporting the photo from the Video Editor

if (Array.isArray(exportedVideoSources) && exportedVideoSources.length === 0) {

// Open Photo Editor after Video Editor export
await this.openPhotoEditorWithImagePath(response?.exportedPreview)

}
}

handlePhotoExport(response) {
let exportedPhotoSource = response?.exportedPhotoSource;
this.setState({ imageUri: `file://${exportedPhotoSource}` });
console.log('Export completed successfully: photo = ' + imageUri);
}

openPhotoEditorWithImagePath = async (photoUri: string) => {
const photoEditor = new PhotoEditorPlugin();
photoEditor
.openFromEditor(LICENSE_TOKEN, photoUri)
.then((response) => this.handlePhotoExport(response))
.catch((e) => this.handleSdkError(e));
};

handleSdkError(e) {
console.log('handle sdk error = ' + e.code);

Expand All @@ -83,6 +109,8 @@ export default class App extends Component {
message = "Missing host Activity to start video editor";
case 'ERR_VIDEO_EXPORT_CANCEL':
message = "The user has canceled video editing flow!";
case 'ERR_PHOTO_EXPORT_CANCEL':
message = 'The user has canceled photo editing flow!';
case 'ERR_INVALID_PARAMS':
message = e.message;
default:
Expand Down
14 changes: 14 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5796,6 +5796,11 @@ path-type@^3.0.0:
path-type@^4.0.0:
version "4.0.0"

pe-sdk-react-native@^0.0.1:
version "0.0.1"
resolved "https://registry.npmjs.org/pe-sdk-react-native/-/pe-sdk-react-native-0.0.1.tgz"
integrity sha512-B80H70lTShagZOuVc1M0nkIqN7Kx5sthHt+Ajscb9xo5u6EHlA7Cf6VE82UCh0dvCysheu42vdnlnrsRTpNVFA==

picocolors@^1.0.0, picocolors@^1.0.1:
version "1.0.1"

Expand Down