名称 最后更新
..
src/main 正在载入提交数据...
.gitignore 正在载入提交数据...
README.md 正在载入提交数据...
build.gradle 正在载入提交数据...
consumer-rules.pro 正在载入提交数据...
gradle.properties 正在载入提交数据...
module.md 正在载入提交数据...
proguard-rules.pro 正在载入提交数据...

Track Processors for LiveKit Android SDK

Maven Central

This library provides track processors for use with the Android LiveKit SDK.

Installation

```groovy title="build.gradle" implementation "io.livekit:livekit-android-track-processors:"


See our [release page](https://github.com/livekit/client-sdk-android/releases) for details on the
current release version.

## Usage of prebuilt processors

This package exposes `VirtualBackgroundVideoProcessor` as a pre-prepared video processor.

val processor = VirtualBackgroundVideoProcessor(eglBase).apply { // Optionally set a background image. // Will blur the background of the video if none is set. val drawable = AppCompatResources.getDrawable(application, R.drawable.background) as BitmapDrawable backgroundImage = drawable.bitmap }


### Register the image analyzer in the CameraProvider

`VirtualBackgroundVideoProcessor` requires the use of our CameraX provider.

val imageAnalysis = ImageAnalysis.Builder().build() .apply { setAnalyzer(Dispatchers.IO.asExecutor(), processor.imageAnalyzer) }

CameraXHelper.createCameraProvider(ProcessLifecycleOwner.get(), arrayOf(imageAnalysis)).let { if (it.isSupported(application)) { CameraCapturerUtils.registerCameraProvider(it) } }


### Create and publish the video track

val videoTrack = room.localParticipant.createVideoTrack( options = LocalVideoTrackOptions(position = CameraPosition.FRONT), videoProcessor = processor, )

videoTrack.startCapture() room.localParticipant.publishVideoTrack(videoTrack)


You can find an offline example of the `VirtualBackgroundVideoProcessor` in
use [here](https://github.com/livekit/client-sdk-android/tree/main/examples/virtual-background).