Skip to content

Commit

Permalink
Video Filter (#1994)
Browse files Browse the repository at this point in the history
* Create video-filters.mdx

* Update video-filters.mdx

* Update video-filters.mdx

* Update video-filters.mdx

* Update release-notes.mdx

* Update release-notes.mdx

* Update release-notes.mdx

---------

Co-authored-by: Pratim Mallick <[email protected]>
  • Loading branch information
gulzar1996 and PratimMallick authored Feb 9, 2024
1 parent fbc7408 commit 1344ba5
Show file tree
Hide file tree
Showing 2 changed files with 155 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
---
title: Video Filters (Beta)
nav: 14.2
---

import AndroidSdkVersionShield from '@/common/android-sdk-version-shield.md';

## 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`.

<AndroidSdkVersionShield />

<Tabs id="sdk-imports" items={['Maven Central']} />

<Tab id='sdk-imports-0'>

```json{5-8}:build.gradle section=AddSDKDependencies sectionIndex=1
dependencies {
// See the version in the badge above.
def hmsVersion = "x.x.x"
implementation "live.100ms:android-sdk:$hmsVersion" // Essential
implementation "live.100ms:video-filters:$hmsVersion" // Optional
}
```

</Tab>


## How to Integrate Video Filters

### Instantiate

Instantiate the 100ms Video Filter plugin like this:

<Tabs id="instanstiate-VirtualBackgroundPlugin" items={['Kotlin']} />

<Tab id='instanstiate-VirtualBackgroundPlugin-0'>

```kotlin
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)
}
}
```

</Tab>


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`.

```kotlin
videoFilterPlugin.setBrightness(progress: Int)
```

### Set Contrast

Adjust Contrast of a video frame. Value is between `0` to `1` default is `0.5`.

```kotlin
videoFilterPlugin.setContrast(progress: Int)
```

### Set Sharpeness

Adjust sharpness of a video frame. Value is between `0` to `1` default is `0.5`.

```kotlin
videoFilterPlugin.setSharpness(progress: Int)
```

### Set Redness

Adjust redness in a video frame. Value is between `0` to `1` default is `0`.

```kotlin
videoFilterPlugin.setRedness(progress: Int)
```

### Set Smoothness

Adjust smoothness in a video frame. Value is between `0` to `1` default is `0`.

```kotlin
videoFilterPlugin.setSmoothness(progress: Int)
```

## Remove/Detach Video Filter Plugin

To remove/detach video plugin at runtime:

<Tabs id="remove-plugin" items={['Kotlin']} />

<Tab id='remove-plugin-0'>

```kotlin

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

override fun onSuccess() {}

})


```

</Tab>


9 changes: 9 additions & 0 deletions docs/android/v2/release-notes/release-notes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,17 @@ import AndroidSdkVersionShield from '@/common/android-sdk-version-shield.md';
| live.100ms:video-view: | <AndroidSdkVersionShield /> |
| live.100ms:hls-player: |<AndroidSdkVersionShield /> |
| live.100ms:hls-player-stats: |<AndroidSdkVersionShield />
| live.100ms:video-filters: |<AndroidSdkVersionShield />|
| live.100ms:virtual-background: |<AndroidSdkVersionShield />|

## v2.9.2 - 2024-02-9
### Added
Added Video Filter Plugin

## v2.9.1 - 2024-02-5
### Added
Previews are now skippable based on settings in the dashboard.

## v2.9.0 - 2024-01-25
### Fixed
- Pixel 4/4a issue with back camera publishing corrupt video
Expand Down

0 comments on commit 1344ba5

Please sign in to comment.