Documentation
Low_Latency_Live Live Streaming
Documentation
Demo APP
SDK Center
API Center
FAQ
Code Market
Console
Sign Up
Log In
中文站 English
  • Documentation
  • Live Streaming
  • Upgrade the livestream
  • Advanced features
  • Enhance the livestream
  • Watermark the live
  • Take snapshots

Watermark your video/Take snapshots

Last updated:2023-05-17 19:00

Introduction

ZEGOCLOUD's SDKs provide the ability to watermark your video stream. For example, businesses and organizations can use the watermark feature to display their logo on the video.

This document mainly describes how to implement the watermark and screenshot features with the Video Call SDK.

Prerequisites

Before you begin, make sure you complete the following:

  • Create a project in ZEGOCLOUD Admin Console and get the AppID and AppSign of your project.

  • Refer to the Quick Start doc to complete the SDK integration and basic function implementation.

Using stream watermark

Currently, the imageURL parameter in the ZegoWatermark object supports the following two path formats:

  1. Accessing the image via the absolute path

    file://[absolute path of the image]: The image must be stored in the directory of the Android app. For example, if the image is stored in the private directory of the Android app: /sdcard/Android/data/im.zego.zegoexpressapp/ZegoLogo.png, then the imageURL should be constructed as: file:///sdcard/Android/data/im.zego.zegoexpressapp/ZegoLogo.png.

// Images in "JPG" and "PNG" formats can be used as watermarks. If the image is stored in the assets directory of the Android project, the [imageURL] should start with a prefix "asset://" followed by the absolute path of the image. If the image is stored in a directory on the Android device, the [imageURL] should start with a prefix "file://" followed by the absolute path of the image.
String imageURL = "file:///sdcard/Android/data/im.zego.zegoexpressapp/ZegoLogo.png";

Rect layout = new Rect(0,0,300,600);
ZegoWatermark watermark = new ZegoWatermark(imageURL, layout);

sdk.setPublishWatermark(watermark, true);
  1. Accessing the Image in the Assets directory of the android project

    asset://[image file name]: If the image is stored in the assets directory of the Android project, the imageURL should start with a prefix asset:// followed by the file name of the image.

    For example, asset://ZegoLogo.png.

    android_asset
```java
//  Images in "JPG" and "PNG" formats can be used as watermarks. If the image is stored in the assets directory of the Android project, the [imageURL] should start with a prefix "asset://" followed by the absolute path of the image. If the image is stored in a directory on the Android device, the [imageURL] should start with a prefix "file://" followed by the absolute path of the image.
String imageURL = "asset://ZegoLogo.png";

Rect layout = new Rect(0,0,300,600);
ZegoWatermark watermark = new ZegoWatermark(imageURL,layout);

sdk.setPublishWatermark(watermark, true);
```

Using snapshot feature

  1. To take a snapshot of the published images, call the takePublishStreamSnapshot method.
engine.takePublishStreamSnapshot(new IZegoPublisherTakeSnapshotCallback() {
                    @Override
                    public void onPublisherTakeSnapshotResult(int errorCode, Bitmap image) {
                       //Save snapshot.         
                    }
                });
  1. To take a snapshot of the played images, call the takePlayStreamSnapshot method.
engine.takePlayStreamSnapshot(streamID,new IZegoPlayerTakeSnapshotCallback() {
                    @Override
                    public void onPlayerTakeSnapshotResult(int errorCode, Bitmap image) {
                        //Save snapshot.
                    }
                });
            }

FAQ

  1. How to set the limageURL property of the ZegoWatermark object?

    Images in "JPG" and "PNG" formats can be used as watermarks. If the image is stored in the assets directory of the Android project, the imageURL should start with the prefix asset:// followed by the absolute path of the image. If the image is stored in a directory on the Android device, the imageURL should start with the prefix file:// followed by the absolute path of the image.

  1. How to set the layout property of the ZegoWatermark object?

    The watermark area cannot exceed the size set by the encoding resolution of the stream.

    For more details about the encoding resolution of the stream, refer to the setVideoConfig method.

Page Directory
  • Free trial
  • 提交工单
    咨询集成、功能及报价等问题
    电话咨询
    400 1006 604
    Get Consulting
    Scan Wechat QR code