Talk to us
Talk to us
menu

Blog Post

start building
Developer

How to Build Video Call Platforms with Video API

How to Build Video Call Platforms with Video API

Video call platform is one of the most lucrative areas of app development. Companies and developers of all sizes are about to step into this market and use Video call API for the best results. Before getting into the in-depth research on building the best video conferencing apps, you should have some understanding of the basic requirements of APIs and SDKs.

It is a one-on-one video call and multi-participant video platform technology. It is related to video chat API, which is empowering the entire digital world with real-time virtual. Easily embed video calling APIs for low-code developer tools for your website or app.

You can easily create unlimited conference rooms with screen sharing, recording, and support to add video chat API & Video streaming API with many participants and visible time.

What is the API?

The API stands for Application Programming Interface, an intermediary tool that allows two applications to communicate with each other. You can save money and time by implementing these APIs and simplify application development. The API provides flexibility and simplifies the design for an innovative approach to technology.

What is the SDK?

A software development kit permits app developers to create applications for a specific platform or programming language. In addition, it can be defined as a toolkit that collects APIs that can be easily assembled to develop an app as a package. However, this kit varies depending on the requirements of each industry.

Selection

Choosing a video streaming API is a big job for professional broadcasters. It is one of the most important decision points and can be a particularly difficult task for those seeking maximum customization capabilities when optimizing players in online video platforms.

How to Choose Video API for Developers

Many professional broadcasters can access video streaming APIs through an online video platform. In general, different platforms come with different API systems and documentation.

When trying to find the best API for your streaming needs, you’ll compare online video platforms with API access rather than the API itself. API access for video streaming is not a standard feature of video streaming, so there is a need to look specifically for platforms with this kind of support.

There are several aspects to assume when selecting an API, all of which depend on your streaming goals. Here are some considerations which you have to do before choosing the Video API developers.

Bandwidth management

Working in a real-world network is important when you build a video call. Video calls are streamed live, so you need a good connection.

Video call developers deal with real-world network problems through bandwidth management. Developers establish quality benchmarks from the data. And then adjust the live stream of video calls, depending on the browser. Expert developers build to do this quickly and smoothly without disrupting server, device, or browser connections. It is important because poor bandwidth management can be a bad user experience.

Do you have a comprehensive document?

Using a unique API is like learning new wording. It is difficult to master skills without formal resources. Of course, you can find your way through trial and error, but it’s much faster to learn by reading a book. In the API, you should look for comprehensive documentation from the provider. They should explain what the call is and give an example.

Ideally, the documentation provides a sandboxed test environment. It allows you to test commands without fear of spoiling things. You want a video broadcast API that provides documentation that you can use to build custom solutions without much hassle.

Degree of customization

It is an important first variable that developers should consider when choosing an established, easy-to-use platform or open source.

Off-the-shelf video APIs like Zoom and Amazon Chime make integrating platforms into your projects easy. Most of the time, it features robust features and performance, which works well. However, most of them can be customized only minimally, both in terms of functionality and aesthetics. However, in most software projects, this limitation is a reasonable trade-off for easier integration.

What programming languages does the selected API support?

The API is agnostic about programming languages, but it does not mean that languages are irrelevant. Many APIs contain mobile SDKs or sample code written in specific languages. Using these languages can save you a lot of time. You can also reuse some of the sample code in production to prevent bugs. It can help you reduce costs, speed up development and ultimately make it a better product.

Overall Cost

When choosing a video API, companies need to balance performance and cost. The problem, however, is that the actual price of the platform is not readily apparent. That’s because the cost per minute per participant is only a few cents. It may seem trivial until it is scaled up.

If you’re going to scale up your video capabilities at scale, the cost is a differentiator. But it may not be that important for smaller teams or companies.

Best Video API for Developers – ZEGOCLOUD

ZEGOCLOUD Video Calling (Express-Video SDK), as the best Twilio video API alternative, allows you to quickly build reliable and scalable video calls and interactive live video streaming into mobile, desktop and web applications for a wide range of use cases, including one-to-one and group video calls, online education and entertainment live video streaming. In just four simple steps, your application can access ZEGOCLOUD’s cloud streaming platform and deliver high-quality, ultra-low latency, interactive video across any platform to end users, supporting large-scale parallel processing to deliver the perfect live video experience to your users.

Embedding live video calls in social apps will allow users to see each other’s faces clearly, feel emotions, and build deeper connections. Add facial beautification, AR effects, and other features to make your video interaction more fun and engaging. You can also create virtual classrooms for all kinds of online learning. High-quality, low-latency real-time video calls, screen sharing, and other features help ensure a successful online learning experience. High-quality video calls, screen sharing, and other features enable remote employees to collaborate effectively, in real-time, from anywhere.

Features

A variety of enhanced features

  • Adding audio beautification, voice changes, and other audio effects can make voice interaction more fun and engage.
  • You can create a more immersive communication experience by adding spatial effects to real-time audio.
  • ZEGOCLOUD offers tools such as facial beautification with AI, virtual makeup, and more to make your face look beautiful on video calls.
  • SEI enables more real-time interaction by delivering text messages with video streams.

What Can I Do with the Video API?

Live video call API applications are becoming more widespread with improved network bandwidth and device performance. It enables many scenarios, such as:

  • Provision of online education
  • Allow video conferencing
  • Get instant telemedicine
  • Stay in touch by video call
  • Perform special tasks with multiplayer

Guides on Video Call API for iOS

ZEGOCall SDK offers several features, including Google login, an online user list, voice and video calls, and offline notifications. And open-source sample code and technical documentation for those features are completely available.

Step 1: ZEGOCLOUD Account Creation

First, you must log in on this platform if you already have an account. Otherwise, you have to signup and create an account. It is very simple to create an account. After this, you can start your project smoothly.

Create a new project

If you have already created a project, then skip this step and go ahead. Otherwise, you must first create the project you want to work on.

Import the SDK

Here are the different methods for importing SDK for your project, but you can choose the best one that looks suitable for you. Select one of the following ways to combine ZEGO Express SDK into your project:

Method 1

Integrate the SDK automatically in CocoaPods

In the first method, you have the option to integrate SD automatically in CocoPods follow these steps to accomplish it.

  • In this step, you have to first Install CocoaPods, and you can also search its guide for more information.
  • Open a terminal, enter the project’s root directory, and run the Pod init command to form a Podfile.
  • Explore Podfile, add Pod ZegoExpressEngine/Video and modify MyProject to the target word. Since the SDK is XCFramwork, you must use CocoaPods 1.10.0 or later to include Zego Express SDK.
target 'MyProject' do
    use_frameworks!
    pod 'ZegoExpressEngine/Video'
end
  • Run the Pod repo update to update the local indexes and ensure that the latest SDK version can be installed. See ZEGO Express-Video iOS SDK Release History for the latest version number. Head to install the Pod for the SDK install.
  • For typical cases you may experience when using CocoaPods, see CocoaPods FAQ.

Method 2

Manually Add SDK to a Project

In the 2nd method, you have to Manually add SDK to a project. It has a few steps to follow, and you will get it done. First of all, you have to download the updated version of the SDK from SDK downloads. We recommend using XCFramework to extract files from the downloaded SDK package. Because Apple defines XCFrameworks as a distributable binary package created by Xcode that includes framework and library variations for use on multiple platforms, including Simulator builds (iOS, macOS, tvOS, and watchOS).

  • Copy the dynamic library file ZegoExpressEngine.framework from the SDK to the project directory.

iOS platform: It supports the arm64 or armv7 architecture of the ios-arm64_armv7

iOS-arm64_x86_64-maccatalyst: Supports arm64, x86_64 architecture in Mac Catalyst mode.

iOS-arm64_x86_64-simulator: A simulator that supports the arm64 and x86_64 architectures on iOS platforms.

  • Now you have to explore the Xcode and pick the File> Add Files to “xxx” because you can add its SDK dynamic library files to the project, as shown in the figure below.
add-video-call-api-file

To add a framework file to the project target:

  • In the first step, you must select the project target and then find the General.
  • Next, when you find the General, please click it and go under Frameworks, Libraries, and Embedded Content. You can find the button to add here, so simply click the Add button (+) below the table.
  • Add a ZegoExpressEngine.framework to the target and set the Embed field to Embed & Sign.
config video call sdk

The Permissions API allows an application to recognize the status of given permission and know if it is allowed, denied, or if the user is asked if the permission should be granted. You can set permissions as needed by applying the following given steps.

Add Permissions

  • First, Open the Xcode, pick the aim object, and tap Info > Custom iOS Target Properties.
camera mic permission
  • Here you find a lot of options to add in the application permission section. You can add any of them that you like to add in the permission. Simply tap the Add button (+) to add camera and microphone approvals.

Now Tab the Privacy option to explore more options, which includes all the necessary permissions as given below.

config device permission
  • Privacy – Camera Usage Description
  • Privacy – Microphone Usage Description

Step 2: Create ZegoExpressEngine Instance

If you want to create a singleton instance of the ZegoExpressEngine class, call the createEngineWithProfile method with the project’s AppID, which you want to develop.

To receive a callback, create a ZegoExpressEngine instance and call the on method. You can listen for and process callbacks as needed. For more information about event callbacks, see ZegoEventListener.

let profile = ZegoEngineProfile()
// The AppID value you get from the ZEGO Admin console.
profile.appID = appID
// Use the general scenario.
profile.scenario = .general
// Create a ZegoExpressEngine instance and set eventHandler to [self]. If eventHandler is set to [nil], no callback will be received. You can set up the event handler later by calling the [-setEventHandler:] method.
ZegoExpressEngine.createEngine(with: profile, eventHandler: self)

Log into a room

Step 3:

Login

Before you can log in to a room, you must first generate an Authentication Using Tokens. To avoid unauthorized service access and manipulation, ZEGO Cloud uses digital Tokens to verify user identities and control and verify user rights. You must pass a Token when logging into a room.

Currently, ZEGOCLOUD supports the following validations:

  • Identity verification: Verify your identity by validating the Token.
  • User Permissions
  • Room Login Privileges: Check the room ID included in the Token to verify users’ privileges to log in to the room.
  • Stream publishing privileges: Verify the user’s ability to publish streams in the room by validating the identity of the public stream contained in the Token.

So, when you log in to a room, call the loginRoom method. If roomID does not exist, calling the loginRoom method creates a new room and automatically logs in.

//create a user
let user = ZegoUser(userID: "user1")
let roomConfig = ZegoRoomConfig()
// Token is generated by the user's own server. For an easier and convenient debugging, you can get a temporary token from the ZEGOCLOUD Admin Console
roomConfig.token = @"xxxxx"
// onRoomUserUpdate callback can be received only by passing in a ZegoRoomConfig whose "isUserStatusNotify" parameter value is "true".
roomConfig.isUserStatusNotify = true
// log in to a room
ZegoExpressEngine.shared().loginRoom(roomID, user: user, config: roomConfig)

Step 4:

Listen and process room users and stream-related event callbacks

If necessary, you can implement the event handlers’ corresponding event callback methods to listen and process the various events that occur after you log in to the room. Below are the available event callbacks associated with room users and streams.

  • roomStateUpdate: A callback for updating the current user’s room connection status. If the current user’s room connection status changes (for example, if the current user is disconnected from the room or if login authentication fails), the SDK sends an event notification through this callback.
  • roomUserUpdate: A callback to update the status of other users in the room. The SDK sends event notifications when other users join or leave a room through this callback.
  • roomStreamUpdate: A callback to update the status of the stream in the room. The SDK sends event notifications via this callback when a new stream is published to a room or when an existing stream in a room is stopped.
// Conform to the ZegoEventHandler protocol to handle event callbacks
class viewController: UIViewController, ZegoEventHandler {
    // Common event callbacks related to room users and streams.

// Callback for updates on the current user's room connection status.
func onRoomStateUpdate(_ state: ZegoRoomState, errorCode: Int32, extendedData: [AnyHashable : Any]?, roomID: String) {
        // Implement the callback handling logic as needed. 
 }

// Callback for updates on the status of other users in the room.
// Users can only receive callbacks when the isUserStatusNotify property of ZegoRoomConfig is set to `true` when logging in to the room (loginRoom).
func onRoomUserUpdate(_ updateType: ZegoUpdateType, userList: [ZegoUser], roomID: String) {
       // Implement the callback handling logic as needed. 
}

// Callback for updates on the status of the streams in the room.
func onRoomStreamUpdate(_ updateType: ZegoUpdateType, streamList: [ZegoStream], extendedData: [AnyHashable : Any]?, roomID: String) {
        // Implement the callback handling logic as needed. 
    // If users want to play the streams published by other users in the room, call the startPlayingStream method with the corresponding streamID obtained from the `streamList` parameter where ZegoUpdateType == ZegoUpdateTypeAdd.
}

Guides on Video Chat API for Android

Setting up your development environment

Before you incorporate ZEGO Express SDK, ensure that your development environment meets the following requirements:

  • Android Studio 2.1 or later
  • The Android SDK package. Here you can find the Android SDK 25,  SDK Build-Tools 25.0.2, and the last one is SDK Platform-Tools 25. x.x or later.
  • An Android terminal or Simulator works with Android 4.4 or later and supports audio and video. It is advised to operate a real device.
  • Your Android terminal is connected to the Internet.

Create a new project

If you already have a project, skip to this step.

Import the SDK

Andriod ABI: the SDK currently supports armeabi-v7a, arm64-v8a, x86, and x86_64. Here are the different methods to import the SDK. You can go ahead with any of them which looks comfortable for you.

Method 1: Integrate the SDK Automatically in JitPack

This process is very easy and comfortable because you can integrate the SDK automatically in JitPack, as given below in detail.

  • In the first step, you must navigate to the project’s root directory and open the build. Gradle file, and count the following sequence to allprojects. Basically, The GRADLE file is a script created by Gradle, a tool used by teams to build and deliver software. This File contains a script that contains a list of commands to be executed by Gradle. The GRADLE file is typically used to store the build script in a domain-specific language based on Groovy.
 ...
 allprojects {
     repositories {
         maven { url 'https://www.jitpack.io' }
         google()
         jcenter()
     }
 }

Navigate to the app directory, and spread the build. Gradle File, and count the following sequence to the dependency: (x.y.z is the SDK version number. To get the latest version number, see ZEGO Express-Video Android SDK Release History)

...
dependencies {
    ...
    // x.y.z is the specific version number of the SDK, for example: 2.7.0
    // Latest version number can be get in the SDK release history.
    implementation 'com.github.zegolibrary:express-video:x.y.z'
}

Method 2: Manually Add SDK to your Project

  • In the first step, you have to download the latest SDK. Android SDK is a collection of software development tools and libraries necessary for developing Android applications. Each time Google releases a new version or update of Android, a corresponding SDK is also released, and developers must download and install it. Extract the files from the SDK package to the project directory (for example, app/libs).
  • Add the Import statement for the SDK. So now you have to explore the app/build. gradle File and add these given sequences:
add video call sdk file

Within the android node, add the source sets node and specify the directory where the SDK files are located.

The directory libs are just an example, so please fill it in according to the actual situation.

config project

Add the following code to the dependency’s node:

implementation fileTree(dir: 'libs', include: ['*.jar'])
ndk {
  abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64' 
}

Add Permissions

You can set permissions as needed.

Open app/src/main/AndroidManifest.xml and add the following code:

<!-- Permissions required by the SDK -->
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.BLUETOOTH" />
    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />

    <!-- Permissons required by the App -->
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />

    <uses-feature
        android:glEsVersion="0x00020000"
        android:required="true" />

    <uses-feature android:name="android.hardware.camera" />
    <uses-feature android:name="android.hardware.camera.autofocus" />

Video call API

Prevent class name complication

To avoid complicating public class names in ZEGO SDK, add the following code to your proguard-rules. pro file:

-keep class **.zego.**{*;}

Create an instance of ZegoExpressEngine

To create a singleton instance of the ZegoExpressEngine class, call the createEngine method with the project’s AppID.

To receive callbacks, implement an event handler object that conforms to the IZegoEventHandler protocol and pass the implemented event handler object as a eventHandler parameter to the createEngine method. Alternatively, you can set the event handler by calling the setEventHandler method after the engine is created by passing null as the eventHandler parameter to the createEngine method.

//  Create a ZegoExpressEngine instance and set eventHandler to [self]. 
// If eventHandler is set to [null], no callback will be received. You can set up the event handler later by calling the [setEventHandler:] method.
ZegoEngineProfile profile = new ZegoEngineProfile();
profile.appID = ;  // The AppID you get from ZEGOCLLOUD Admin Console. AppID format: 123456789L
profile.appSign = ;  // The AppSign you get from ZEGOCLOUD Admin Console. AppSign format: @"0123456789012345678901234567890123456789012345678901234567890123" (64 characters)
profile.scenario = ZegoScenario.GENERAL;  // Use general scenario.
profile.application = getApplication();
engine = ZegoExpressEngine.createEngine(profile, null);

Log in Room

To log in to a room, call the loginRoom method. If roomID does not exist, calling the loginRoom method creates a new room and allows you to log in automatically.

/** create a user */
ZegoUser user = new ZegoUser("user1");


ZegoRoomConfig roomConfig = new ZegoRoomConfig();
/** Token is generated by the user's own server. For an easier and convenient debugging, you can get a temporary token from the ZEGOCLOUD Admin Console */
roomConfig.token = "xxxx";
/** onRoomUserUpdate callback can be received only by passing in a ZegoRoomConfig whose "isUserStatusNotify" parameter value is "true".*/
roomConfig.isUserStatusNotify = true;

/** log in to a room */
engine.loginRoom("room1", user, roomConfig, (int error, JSONObject extendedData)->{
    // (Optional callback) The result of logging in to the room. If you only pay attention to the login result, you can use this callback.
});  

Then, if necessary, you can implement the corresponding event callback methods of the event handler to listen and handle the various events that may occur after logging into the room. Below are the general event callbacks associated with room users and streams.

  • onRoomStateUpdate: A callback for updating the current user’s room connection status. If the current user’s room connection status changes (for example, if the current user is disconnected from the room or if login authentication fails), the SDK sends an event notification through this callback.
  • onRoomUserUpdate: A callback to update the status of other users in the room. When other users join or leave a room, the SDK sends event notifications via this callback.
  • onRoomStreamUpdate: A callback to update the status of a stream in a room. The SDK sends event notifications via this callback when a new stream is published to a room or when an existing stream in a room is stopped.
engine.setEventHandler(new IZegoEventHandler() {

    /** Common event callbacks related to room users and streams. */

    /** Callback for updates on the current user's room connection status. */
    @Override
    public void onRoomStateUpdate(String roomID, ZegoRoomState state, int errorCode, JSONObject extendedData) {
        /** Implement the callback handling logic as needed. */
    }

    /** Callback for updates on the status of other users in the room. */
    @Override
    public void onRoomUserUpdate(String roomID, ZegoUpdateType updateType, ArrayList<ZegoUser> userList) {
        /** Implement the callback handling logic as needed. */
    }

    /** Callback for updates on the status of the streams in the room. */
    @Override
    public void onRoomStreamUpdate(String roomID, ZegoUpdateType updateType, ArrayList<ZegoStream> streamList, JSONObject extendedData){
        /** Implement the callback handling logic as needed. */
     }

});

Final Verdict

With the growing demand for video calling APIs, more companies are offering these APIs, but the features offered are similar in some ways. ZEGO video conferencing APIs and SDKs utilize the latest video technology, using less bandwidth with the same top-notch video quality. You can always expect clear audio and video. In addition, it can maintain better video quality even in a poor Internet environment. So, you can go ahead with the ZEGO compared to others, and its guide for iOS and Android is described in this article for your better understanding.

ZEGOCLOUD
ZEGOCLOUD With our fully customizable and easy-to-integrate Live SDK, you can quickly build reliable, scalable, and interactive live streaming into your mobile, web, and desktop apps.

Related posts

Contact us