# Raw video with alpha channel

<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

When alpha channel mode is on, the Video SDK for Android delivers a per-pixel alpha mask alongside each raw YUV frame. The mask marks the participant's silhouette, so you can composite their video over your own background (virtual scenes, slide decks, AR overlays) without running your own segmentation model.

On the _raw-data_ side, alpha channel mode delivers a per-pixel mask you read from `ZoomVideoSDKVideoRawData`. To turn the mode on or off, see [Alpha channel mode](/docs/video-sdk/android/video/camera-controls/#alpha-channel-mode) in Camera controls. The same `ZoomVideoSDKVideoHelper` toggles apply whether you render with `ZoomVideoSDKVideoView` or consume raw data.

## Read the alpha buffer

When alpha mode is on, the `ZoomVideoSDKVideoRawData` you receive in `onRawDataFrameReceived` carries an extra alpha plane in addition to the YUV planes.

```kotlin
override fun onRawDataFrameReceived(rawData: ZoomVideoSDKVideoRawData?) {
    rawData ?: return

    val yBuffer = rawData.yBuffer
    val uBuffer = rawData.uBuffer
    val vBuffer = rawData.vBuffer
    val alphaBuffer = rawData.alphaBuffer  // populated only while alpha mode is on
    // Composite: yBuffer/uBuffer/vBuffer for color, alphaBuffer for mask.
}
```

```java
@Override
public void onRawDataFrameReceived(ZoomVideoSDKVideoRawData rawData) {
    if (rawData == null) return;

    ByteBuffer yBuffer = rawData.getyBuffer();
    ByteBuffer uBuffer = rawData.getuBuffer();
    ByteBuffer vBuffer = rawData.getvBuffer();
    ByteBuffer alphaBuffer = rawData.getAlphaBuffer();  // populated only while alpha mode is on
    // Composite: yBuffer/uBuffer/vBuffer for color, alphaBuffer for mask.
}
```

The alpha plane is the same width and height as the Y plane. Use the `onVideoAlphaChannelStatusChanged` callback below as the authoritative signal for whether alpha data is present. Don't rely on null-checking `getAlphaBuffer()`.

## Listen for alpha mode changes

When alpha mode is toggled (by your app or by a remote participant who is sending alpha data), the SDK fires `onVideoAlphaChannelStatusChanged`. Use it to update any UI that depends on whether you're receiving an alpha mask.

```kotlin
override fun onVideoAlphaChannelStatusChanged(isAlphaModeOn: Boolean) {
    // Re-render any cached composites — alpha presence has changed.
}
```

```java
@Override
public void onVideoAlphaChannelStatusChanged(boolean isAlphaModeOn) {
    // Re-render any cached composites — alpha presence has changed.
}
```
