npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@zegocloud/zego-effects-reactnative

v1.0.24

Published

React Native Zego Effects for Android & iOS

Downloads

306

Readme

zego-effects-reactnative

Zego Effects SDK for React Native.

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.');
}