Skip to main content

Banuba SDK Player API Android


Player API — a set of classes and methods that help facilitate and speed up the integration of the Banuba SDK into applications. The Player API concept distinguishes three main entities — these are Input, Player and Output.

Basic Player API packages:

  • com.banuba.sdk.input — all classes responsible for input data, the Input entity.
  • com.banuba.sdk.player — rendering thread and the Player, the Player entity.
  • com.banuba.sdk.output — all classes responsible for output data, the Output entity.
  • com.banuba.sdk.frame — pixel buffer, used for both input and output.


Input — receives frames from a camera, image, or user input and provides them to the Player. The Player can only work with one Input at a time.

  • CameraInput — the class provides frames from the front or rear camera in real time.
  • ProtoInput — the class provides frames as photos taken by the camera or loaded from a file.
  • StreamInput — the class provides user frames from user data.


Player — the class requests frames from Input, then processes frames using the Banuba SDK and passes the processing result to one or more Outputs. By default, frame processing in the Banuba SDK works automatically. Optionally, you can enable on-demand processing.


Output — receives the result of the work from the Player, renders it to the surface, writes it to a file, or or provides the user with frames in a supported format.

  • FrameOutput — provides the user with data in the form of a buffer of pixels, with a given orientation and mirroring, RGBA and YUV I420 output formats are supported.
  • SurfaceOutput — renders frames to the surface.
  • VideoOutput — writes frames to a video file.

Input and output of user data

The Input and the Output can operate on a pixel buffer.

  • FramePixelBuffer — provides access to an array of pixels as a byte buffer. In the StreamInput class it is used as the input data buffer and in the FrameOutput class it is used as the output data buffer.
  • FramePixelBufferFormat — pixel buffer format can be one of: RGBA, I420_BT601_FULL, I420_BT601_VIDEO, I420_BT709_FULL or I420_BT709_VIDEO.

A simple example of using Player API

class MainActivity : AppCompatActivity() {
// The player executes the main pipeline
private val player by lazy(LazyThreadSafetyMode.NONE) {

// This camera device will pass frames to the CameraInput
private val cameraDevice by lazy(LazyThreadSafetyMode.NONE) {
CameraDevice(requireNotNull(this.applicationContext), this@MainActivity)

// The result will be displayed on the surface
private val surfaceOutput by lazy(LazyThreadSafetyMode.NONE) {

override fun onCreate(savedInstanceState: Bundle?) {

// Initialize the Banuba SDK with client token
BanubaSdkManager.initialize(this, <#MY CLIENT TOKEN#>);

// Set where the player will take input frames from

// Set where the player will display the result

// Loading the effect

override fun onResume() {

override fun onPause() {

override fun onDestroy() {

For a fully functional example, you need to add the code for receiving and checking permissions on the camera. And only after that call cameraDevice.start().

Binaries size

We include native debug symbols in our .aar archives, so you may find that banuba_effect_player.aar is too big (about 100 MB). These symbols will help us to get clear crash logs. Nevertheless, Android Studio will silently strip them from release apps, and no extra actions are required.

Still have any questions about FaceAR SDK for Android?

Visit our FAQ or contact our support.