Camera filter is a feature that you can use to apply face filters on the host's face. By using various face filters, the host will be able to offer an engaging and entertaining live event experience for the participants. Follow this guide to integrate Banuba Face Filters SDK to Sendbird Live SDK.
The minium requirements to implement camera filter for Live SDK for iOS are:
- Xcode 13
- iOS 11.0 and later
- Swift 5.0 and later
- Sendbird Live SDK 1.0.0-beta.5
- Banuba Face Filters SDK
Before you start
Before installing the Live SDK, create a Sendbird account to acquire an application ID which you will need to initialize the Live SDK. Go to Sendbird Dashboard and create an application by selecting Calls+Live in product type. Once you have created an application, go to Overview and you will see the Application ID.
How it works
In this guide, you will be installing Sendbird Live SDK and Banuba Face Filters SDK. After installing and initializing the two SDKs, you will set up a live event by using some essential UI components to integrate face filters to a live event in the quickest manner.
Once you create a user to act as a host, you can start a live event and add face filters on the host's camera feed. You can also enter the live event to watch as a participant using our UIKit sample. Follow along this guide using the sample app for camera filter which you can download here.
Install the Live SDK and Face Filters SDK
First, install the Live SDK for iOS and the Face Filters SDK to a new client app. To download the two SDKs, add the following lines to your
Grant media access permissions
To use microphone and video on a mobile device, you need to ask the users to grant the media access permission on their devices. If the access permission is denied, the audio and video won't work during the live event.
Initialize the Live SDK
To integrate the Live SDK in a client app, initialize the Live SDK with a Sendbird application ID by adding the code below.
If you already have an application ID, log in to Sendbird Dashboard, go to Overview and you will see the Application ID, or get one by creating an application by selecting Calls+Live in product type.
Authenticate a user
To use the interfaces of the Live SDK, you need to authenticate a user. You can authenticate a user by providing their user ID and access token in
SendbirdLive.authenticate. This will establish a connection between the Sendbird server and the user. Once you have authenticated and connected the user, the user can act as a host to create, enter, and start a live event.
Set up a live event with UI components
To set up a live event, provide UI views to create, enter, and start a live event. This will allow you to start a live event using the most essential and minimal components which would look like views shown in the image below.
Step 1 Create and enter a live event
First, provide credentials to log into the client app. After logging in, select the Go live button to create and enter the live event. When you enter, you will be the host of the live event which allows you to control the live event such as whether to start or stop your media stream.
Step 2 Start the live event
When you start the live event, participants can enter your live event, view the host's media stream, and chat. To start the live event, follow the code below.
If you would like to learn more about using the full-fledged UI features for Sendbird Live, go to Live UIKit Overview page.
Initialize the Face Filters SDK
You need to initialize the Face Filters SDK that you downloaded previously by using Banuba's SDK token. Visit their website to get a valid token and follow the code shown below to initialize the SDK.
Stream with Face Filters SDK
Once the Face Filters SDK is initialized, you can select filters to apply to the host's face. To stream a live event that has filters applied, you need to let the Live SDK know that such external video will be streaming instead of the default camera. Then, the Face Filters SDK delivers modified video frames through its handler which the Live SDK can use to stream to the participants. Take the steps below to apply the filters and stream the modified video.
Step 1 Configure the Face Filters SDK
First, set up the Face Filters SDK with the correct configurations then choose the desired face filter. You can learn more about the Banuba Face Filters SDK from here.
Step 2 Streaming with external video frames
By implementing the code below, you first have to let the live event know that the host will be streaming using an external video source processed by the Face Filters SDK, not from the default camera.
Step 3 Apply face filters to external video frames
You can select face filters to apply to the host's face. Once you select filters, the Face Filters SDK modifies the camera feed to apply the filters and returns the processed frames through its handler. Pass the frames to the live event to stream to the participants.
Step 4 Stop streaming with external video frames
If you would like to stop streaming with face filters, call
stopUsingExternalVideo(). After calling the
stopUsingExternalVideo() method, the host's media stream will return to the default camera. If you would like the host to stream from another camera, specify the device using the
Watch the live event as a participant
To watch the ongoing live event as a participant, download Sendbird Live sample app for iOS from The App Store, for Android from Google Play, or from Github. You can also use Live studio from Sendbird Dashboard to test Sendbird Live.