New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@zegocloud/zego-effects-reactnative

Package Overview
Dependencies
Maintainers
0
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zegocloud/zego-effects-reactnative

React Native Zego Effects for Android & iOS

  • 2.0.3
  • npm
  • Socket score

Version published
Weekly downloads
14
decreased by-79.1%
Maintainers
0
Weekly downloads
 
Created
Source

zego-effects-reactnative

Zego Effects SDK for React Native.

  • 中文

  • API

Getting started

$ yarn add @zegocloud/zego-effects-reactnative

Usage

Download and Import Resources into the Project

Download the latest version of the Effects SDK from the SDK download site (iOS download link: https://doc-zh.zego.im/article/15898, Android download link: https://doc-zh.zego.im/article/15899). After extracting it, import the Resources and Models folders into your project.

Note: You only need to add the resources and models to your project; @zegocloud/zego-effects-reactnative will automatically download the SDK itself.

  • iOS: Add the Resources and Models folders to your Xcode project and choose the Create folders option in the Group settings. Assuming your project name is example and you place all resources in the Assets folder, your project directory structure should look like this after importing:
# ios
├── example
│   ├── AppDelegate.h
│   ├── AppDelegate.mm
│   ├── Images.xcassets
├── Assets
│   ├── Models
│   │   ├── FaceDetectionModel.model
│   │   └── SegmentationModel.model
│   └── Resources
│       ├── ColorfulStyleResources
│       ├── CommonResources.bundle
│       ├── FaceWhiteningResources.bundle
│       ├── MakeupResources
│       ├── PendantResources.bundle
│       ├── RosyResources.bundle
│       └── TeethWhiteningResources.bundle
│
  • Android: Add the Resources and Models folders to the assets directory in your Android project. Typically, the resources should be placed in the android/app/src/main/assets directory, so your project directory structure should look like this after importing:
# android/app/src/main
├── AndroidManifest.xml
├── assets
│   ├── Models
│   │   ├── FaceDetectionModel.model
│   │   └── SegmentationModel.model
│   └── Resources
│       ├── ColorfulStyleResources
│       ├── CommonResources.bundle
│       ├── FaceWhiteningResources.bundle
│       ├── MakeupResources
│       ├── PendantResources.bundle
│       ├── RosyResources.bundle
│       └── TeethWhiteningResources.bundle
├── java
└── res

Code Invocation

import ZegoEffects from '@zegocloud/zego-effects-reactnative';

/**
 * Initializes the beauty effects SDK.
 * This method should be called after the Express instance is created.
 */
async function initEffects() {
  // Enable custom video processing for Express and Effects
  // engine is an instance of ExpressEngine
  await engine.enableCustomVideoProcessing(true, {}, ZegoPublishChannel.Main);

  // Log the version of the Effects SDK
  console.log(`Effects version=${await ZegoEffects.getVersion()}`);

  // Retrieve authentication information from the SDK
  const authInfo: string = await ZegoEffects.getAuthInfo(appSign);

  // Fetch the license from the Zego server, see: https://doc-zh.zego.im/article/12199
  const license: string = await getLicenseFromZegoServer(appID, authInfo);

  // Create an Effects instance with the fetched license
  const effects = new ZegoEffects(license);

  // Listen for error events and handle them
  effects.on('error', (errorCode: number, desc: string) => {
    // Log the error message for debugging purposes
    console.error(`Error code: ${errorCode}, Description: ${desc}`);
  });

  // Enable custom handler for Express and image processing for Effects
  effects.enableImageProcessing(true);

  // Enable and configure the smoothing effect for better beautification
  effects.enableSmooth(true);
  effects.setSmoothParam({ intensity: 100 });

  // Enable the face-lifting effect to create a smaller face appearance
  effects.enableFaceLifting(true);
  effects.setFaceLiftingParam({ intensity: 100 });

  // Additional steps can be added here for other effects or configurations
  // For example:
  // effects.enableWhitening(true);
  // effects.setWhiteningParam({ intensity: 50 });

  // Ensure that all effects are properly enabled and configured
  console.log('Beauty effects initialized successfully.');
}

Keywords

FAQs

Package last updated on 19 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc