addVideoWatermark method

  1. @override
Future<void> addVideoWatermark(
  1. String watermarkUrl,
  2. WatermarkOptions options
)

Adds a watermark image to the local video.

This method adds a PNG watermark image to the local video stream in a live broadcast. Once the watermark image is added, all the audience in the channel (CDN audience included), and the recording device can see and capture it.

Meta supports adding only one watermark image onto the local video, and the newly watermark image replaces the previous one.

The watermark position depends on the settings in the RtcEngine.setVideoEncoderConfiguration method:

Note

  • Ensure that you have called the RtcEngine.enableVideo method to enable the video module before calling this method.
  • If you only want to add a watermark image to the local video for the audience in the CDN LiveBroadcasting channel to see and capture, you can call this method or the RtcEngine.setLiveTranscoding method.
  • This method supports adding a watermark image in the PNG file format only. Supported pixel formats of the PNG image are RGBA, RGB, Palette, Gray, and Alpha_gray.
  • If the dimensions the PNG image differ from your settings in this method, the image will be cropped or zoomed to conform to your settings.
  • If you have enabled the local video preview by calling the startPreview method, you can use the visibleInPreview member in the WatermarkOptions class to set whether or not the watermark is visible in preview.
  • If you have enabled the mirror mode for the local video, the watermark on the local video is also mirrored. To avoid mirroring the watermark, Meta recommends that you do not use the mirror and watermark functions for the local video at the same time. You can implement the watermark function in your application layer.

Parameter watermarkUrl The local file path of the watermark image to be added. This method supports adding a watermark image from either the local file path or the assets file path. If you use the assets file path, you need to start with /assets/ when filling in this parameter.

Parameter options The options of the watermark image to be added. See WatermarkOptions.

Implementation

@override
Future<void> addVideoWatermark(
    String watermarkUrl, WatermarkOptions options) {
  return _invokeMethod('addVideoWatermark',
      {'watermarkUrl': watermarkUrl, 'options': options.toJson()});
}