Integrate an extension
Extensions are add-ons designed to rapidly extend the functionality of your app. 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 app. 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.
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:
- Implemented either of the following:
-
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:
-
Activate an extension
-
Log in to Agora Console.
-
In the left navigation panel, click Extension Marketplace, then click the extension you want to activate.
You are now on the extension detail page.
-
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.
-
-
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.
-
-
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.
-
Download the extension
In the extension detail page, click Download, then unzip the extension in a local directory.
-
Install the extension in your project
-
Android Archive file (
.aar
)-
Save the extension
.aar
file to/app/libs
in your project. -
In
/Gradle Scripts/build.gradle(Module: <ProjectName> app)
, add the following line underdependencies
:
-
-
Shared Library (
.so
)Save the
.so
file to the following paths in your project:-
/app/src/main/jniLibs/arm64-v8a
-
/app/src/main/jniLibs/armeabi-v7a
-
-
You are now ready to integrate the extension in your app.
Integrate the extension into your project
The watermark extension adds a watermark on video streamed to your local client. This section shows you how to implement the watermark extension in your Agora project:
-
Import the necessary classes
-
Download the watermark extension and follow the steps for
.aar
files in setup. -
In
app/src/main/java/com.example.<projectname>/MainActivity
:-
Add the following lines to import the Android classes used by the extension:
-
Add the following lines to import the Agora classes used by the extension:
-
-
-
Add the extension and register the event handler
In
setupVideoSDKEngine
, add the following code beforeagoraEngine = RtcEngine.create(config);
: -
Enable the extension
Call enableExtension to enable the extension. To enable multiple extensions, call
enableExtension
as many times. The sequence of enabling multiple extensions determines the order of these extensions in the transmission pipeline. For example, if you enable extension A before extension B, extension A processes data from the SDK before extension B.In
setupVideoSDKEngine
, add the following code beforeagoraEngine = RtcEngine.create(config);
: -
Set extension properties
In the
joinChannel(View view)
method, add the following code afteragoraEngine.joinChannel
:
Test your implementation
To ensure that you have integrated the extension in your app:
-
Connect the Android device to the computer.
-
Click
Run app
on your Android Studio. A moment later you will see the project installed on your device. -
When the app launches, you can see yourself and the watermark
Agora
on the local view.
Reference
This section contains content that completes the information on this page, or points you to documentation that explains other aspects to this product.