Bitmap Plugin

Introduction

The Bitmap Plugin facilitates the analysis or transformation of bitmap images. This doc provides an overview of using the Bitmap Plugin within the 100ms SDK.

Supported Versions/Resolutions

  • Minimum 100ms SDK version it can work with is 2.9.58
  • Has poor fps on older android phones

Add dependency

build.gradle
dependencies { // See the version in the badge above. def hmsVersion = "x.x.x"
implementation "live.100ms:android-sdk:$hmsVersion" // Essential
}

How to enable Bitmap Plugin:

Instantiate

💡On instantiating Bitmap Plugin

Always call addPlugin() after onJoin() from hmsSDK.join() or onPreview() from hmsSDK.preview()

val hmsSDK = HMSSDK .Builder(application) .build() val bitmapListener = object : HMSBitmapUpdateListener { override fun onFrame(bitmap: Bitmap): Bitmap { //analyze or process bitmap here return bitmap } } val bitmapPlugin by lazy { HMSBitmapPlugin(hmsSDK, bitmapListener) } //call this after onJoin() or after onPreview() fun addBitmapPlugin() { if (hmsSDK.getLocalPeer()?.videoTrack != null) { hmsSDK.addPlugin(bitmapPlugin, object : HMSActionResultListener { override fun onError(error: HMSException) {} override fun onSuccess() { } }) } }
💡Bitmap Plugin

The longer the processing of bitmap takes, the lower would be FPS. Ideally try to process the bitmap under 33 ms to achieve 30 FPS

val bitmapListener = object : HMSBitmapUpdateListener { override fun onFrame(bitmap: Bitmap): Bitmap { //analyze or process bitmap here val processedBitmap = // Send bitmap for processing here and return the processed bitmap return processedBitmap } }

Remove/Detach/Disable Bitmap Plugin

To remove/detach bitmap plugin at runtime:

hmsSDK.removePlugin(bitmapPlugin, object : HMSActionResultListener { override fun onError(error: HMSException) {} override fun onSuccess() {} })

Have a suggestion? Recommend changes ->

Was this helpful?

1234