Skip to main content
Android
iOS
macOS
Web
Windows
Electron
Flutter
React Native
React JS
Unity
Unreal Engine
Unreal (Blueprint)

Integrate an extension

Extensions are add-ons designed to rapidly extend the functionality of your game. Extensions Marketplace is home to extensions that make your app more fun. Extensions provide features such as Audio effects and voice changing, Face filters and background removal, and Live transcription and captioning.

In the Agora Extensions Marketplace:

  • Vendors create and publish extensions to provide functionality such as audio and video processing.
  • App developers use extensions to quickly implement fun and interactive functionality.

This page shows you how to integrate an extension from Agora Extensions Marketplace into your game. There can be specific guidance for each extension.

Understand the tech

An extension accesses voice and video data when it is captured from the user's local device, modifies it, then plays the updated data to local and remote video channels.

img

A typical transmission pipeline consists of a chain of procedures, including capture, pre-processing, encoding, transmitting, decoding, post-processing, and play. Audio or video extensions are inserted into either the pre-processing or post-processing procedure, in order to modify the voice or video data in the transmission pipeline.

Prerequisites

To test the code used in this page you need to have:

  • An Agora account and project.

  • A computer with Internet access.

    Ensure that no firewall is blocking your network communication.

Project setup

In order to integrate an extension into your project:

  1. Activate an extension

    1. Log in to Agora Console.

    2. In the left navigation panel, click Extension Marketplace, then click the extension you want to activate.

      You are now on the extension detail page.

    3. Select a pricing plan and click Buy and Activate.

      • If you have already created an Agora project:

        The Projects section appears and lists all of your projects.

      • If you have not created an Agora project:

        Create a new project, the project appears in the Projects section.

    4. Under Projects on the extension detail page, find the project in which you want to use the extension, then turn on the switch in the Action column.

  2. Get the apiKey and apiSecret for the extension

    If required for the extension, to get the extension apiKey and apiSecret, in the Projects extension detail page, click View in the Secret column.

  1. Open your Unity project

    Load the SDK quickstart Broadcast Streaming project you created previously.

  2. Get the extension

    Visit the Agora Extensions Marketplace and follow the procedure to download and install the desired extension.

You are now ready to integrate the extension in your game.

Integrate the extension into your project

This section presents the framework code you add to your Unity project to integrate an extension.

  1. Load the extension provider

    You call loadExtensionProvider during Agora Engine initialization to specify the extension library path. To do this, add the following code to the SetupVideoSDKEngine method after you initialize the engine with RtcEngine.Initialize:

    RtcEngine.LoadExtensionProvider("<extensionLibraryPath>");
    Copy
  2. Enable the extension

    To enable the extension, add the following code to the Join method before RtcEngine.EnableVideo();:

    RtcEngine.EnableExtension(
    provider: "<The name of the extension provider>",
    extension: "<extensionName>",
    enable: true,
    type: MEDIA_SOURCE_TYPE.UNKNOWN_MEDIA_SOURCE
    );
    Copy
    Extensions marketplace hosts both third-party extensions as well as those developed by Agora. To use an Agora extension, you do not need to call EnableExtension.

    To enable multiple extensions, call EnableExtension for each extension. The calls to EnableExtension determines the order of each extension in the transmission pipeline. For example, if you enable extension A before extension B, Video SDK processes data from extension A before extension B.

  3. Set extension properties

    To customize the extension for your particular game, set suitable values for the extension properties. Refer to the extension documentation for a list of available property names and allowable values. To set a property, add the following code to the Join method after RtcEngine.EnableExtension:

    RtcEngine.SetExtensionProperty(
    provider: "<providerName>",
    extension: "<extensionName>",
    key: "<keyName>",
    value: "<keyValue>"
    );
    Copy

Test your implementation

To ensure that you have integrated the extension in your game:

  1. Set the variables and properties in the project code to values suitable for your chosen extension.

  2. Generate a temporary token in Agora Console.

  3. In your browser, navigate to the Agora web demo and update App ID, Channel, and Token with the values for your temporary token, then click Join.

  4. In Unity Editor, in Assets/Agora-RTC-Plugin/Agora-Unity-RTC-SDK/Code/JoinChannelVideo.cs, update _appID, _channelName, and _token with the values for your temporary token.

  5. In Unity Editor, click Play. A moment later you see the game installed on your device.

  1. Select a role using the toggle buttons and click Join to start an Broadcast Streaming session.
  1. Experience the features of your new extension.

Reference

This section contains content that completes the information on this page, or points you to documentation that explains other aspects to this product.

vundefined