Video Filters (Beta)
Introduction
Video filter plugin helps in altering brightness, contrast, sharpeness or smoothness of a video frame This guide provides an overview of usage of the Video Filter plugin of 100ms.
Supported Versions/Resolutions
- Minimum 100ms SDK version it can work with is
2.9.2
- Maximum supported resolution for this feature is 720p
- Works best on 15fps
Add dependency
- Adding the Beauty filtet plugin and SDK dependency to your app-level
build.gradle
.
dependencies { // See the version in the badge above. def hmsVersion = "x.x.x"
implementation "live.100ms:android-sdk:$hmsVersion" // Essentialimplementation "live.100ms:video-filters:$hmsVersion" // Optional}
How to Integrate Video Filters
Instantiate
Instantiate the 100ms Video Filter plugin like this:
val hmsSDK = HMSSDK .Builder(application) .build() val videoFilterPlugin by lazy { HMSVideoFilter(hmsSDK) } //call this after onJoin() fun addBeautyFilterPlugin() { if (hmsSDK.getLocalPeer()?.videoTrack != null) { videoFilterPlugin.init() hmsSDK.addPlugin(videoFilterPlugin, object : HMSActionResultListener { override fun onError(error: HMSException) {} override fun onSuccess() { } }, 30) } }
Now let's take a look at the method signature of HMSVideoFilter
.
Set Brightness
Adjust Brightness of a video frame. Value is between 0
to 1
default is 0.5
.
videoFilterPlugin.setBrightness(progress: Int)
Set Contrast
Adjust Contrast of a video frame. Value is between 0
to 1
default is 0.5
.
videoFilterPlugin.setContrast(progress: Int)
Set Sharpeness
Adjust sharpness of a video frame. Value is between 0
to 1
default is 0.5
.
videoFilterPlugin.setSharpness(progress: Int)
Set Redness
Adjust redness in a video frame. Value is between 0
to 1
default is 0
.
videoFilterPlugin.setRedness(progress: Int)
Set Smoothness
Adjust smoothness in a video frame. Value is between 0
to 1
default is 0
.
videoFilterPlugin.setSmoothness(progress: Int)
Remove/Detach Video Filter Plugin
To remove/detach video plugin at runtime:
videoFilterPlugin.stop() hmsSDK.removePlugin(videoFilterPlugin, object : HMSActionResultListener { override fun onError(error: HMSException) {} override fun onSuccess() {} })