Video Call
  • iOS
  • Android : Java
  • Web
  • Flutter
  • React Native
  • Electron
  • Unity3D
  • Cocos Creator
  • Windows
  • macOS
  • Linux
  • Overview
  • Develop your app
    • Quick start
    • Enhance basic feature
      • Use Tokens for authentication
      • Config your video based on scenes
      • Check the room connection status
      • Set up common video config
      • Set up common audio config
  • Best practices
    • Implement a video call for multiple users
    • Implement call invitation
    • Implement a live audio room
  • Upgrade using advanced features
    • Advanced features
      • Configure the video
        • Watermark the video/Take snapshots
        • Improve your appearance in the video
        • Beautify & Change the voice
        • Configure video codec
        • Output the video in H.265
      • Improve video quality
        • Configure bandwidth management
        • Test network and devices in advance
        • Visualize the sound level
        • Monitor streaming quality
      • Message signaling
        • Convey extra information using SEI
        • Broadcast real-time messages to a room
        • Quotas and limits
      • Play media files
        • Play media files
        • Play sound effects
      • Share the screen
      • Mix the video streams
      • Publish multiple video streams
      • Encrypt the video streams
      • Record video media data
    • Distincitve features
      • Join multiple rooms
      • Customize the video and audio
      • Set the voice hearing range
      • Transfer traffic via the cloud proxy server
      • Use the bit mask
      • Play streams via URL
      • Play a transparent gift special effect
      • AI Voice Changer
      • In-game voice chat
  • Upgrade using Add-on
  • Resources & Reference
    • SDK
    • Sample codes
    • API reference
      • Client APIs
      • Server APIs
    • Debugging
      • Error codes
      • Logging/Version number
    • FAQs
    • Key concepts
  • Documentation
  • Video Call
  • Upgrade using advanced features
  • Advanced features
  • Configure the video
  • Watermark the video
  • 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