Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • Key Widgets
  • UI Components
  • Design & Animations
  • Forms & Gestures
  • Navigation & Routing
  • Flutter Interview Questions
  • Dart
  • Android
  • Kotlin
  • Kotlin Android
  • Android with Java
  • Android Studio
Open In App
Next Article:
How to Build a Flutter App to Display Device Details?
Next article icon

How to Build a Video Calling App in Flutter?

Last Updated : 28 Sep, 2022
Comments
Improve
Suggest changes
Like Article
Like
Report

Video Calling has become a necessary feature in most real-time communication applications used around the world. Its primary application is to connect people from all around the world along with other obvious applications. Chat applications like Facebook, WhatsApp, and Instagram all have video calling features. Zoom, Google Meet, Microsoft Teams, and other such applications thrive on video calling as their fundamental feature. In this article, we learn how to make a Video/Audio Calling application using the Flutter framework and Agora Software Development Kit.

Understanding the Architecture

Understanding the Architecture
 

The above flowchart gives an idea of how to integrate the video call functionality into our Flutter App. For an app client to join a channel, you need the following information:

  • App ID: A string that Agora created at random to identify your app. Agora Console is where you can find the App ID.
  • user ID: A user's special identification number. The user ID must be self-specified, and you must make sure it is exclusive to the channel.
  • Token: Your app client obtains tokens from a server in your security infrastructure in a test or production environment. You obtain a temporary token with a 24-hour validity period from Agora Console and use it for this page.
  • Channel name: A string that indicates the video call's channel.

Prerequisites

Target Platform: Windows

  • Flutter >=2.0 
  • Dart >=2.14.0 
  • Windows OS
  • Visual Studio (Most recent versions recommended)
  • A valid Agora developer account

Get App ID and Token

Step 1: Create an Agora project

To create an Agora project, do the following: Enter the Project Management page->Click Create->Enter the project name and use case by adhering to the on-screen directions, and check Secured mode: APP ID + Token as the authentication procedure->Click Submit. You can now view the project on the Project Management page.

Step 2: Get an App ID

As a distinctive identification, Agora automatically assigns an App ID to each project. To copy this App ID, find your project on the Project Management page in Agora Console, and click the copy icon in the App ID column.

Step 3: Generate a temporary token

Agora proposes utilizing tokens to authenticate people joining a channel in order to ensure communication security. For testing purposes, Agora Console supports generating RTC temporary tokens. To generate an RTC temporary token:

On the Project Management page, find your project and click Config.
 

 

Click Generate temp RTC token.

 

Enter the name of the channel that you want to join, and click Generate. When joining the channel later, ensure that the channel name is the same as the one you enter here.

 

Click the copy icon to copy the temporary token.

Create a Flutter Project

Add dependencies:

Add the following dependencies in the pubspec.yaml file:

  1. Add the agora_rtc_engine dependency to integrate Agora Flutter SDK. See https://pub.dev/packages/agora_rtc_engine for the latest version of agora_rtc_engine.
  2. Add the permission_handler dependency to add the permission handling function.
environment:    sdk: ">=2.12.0 <3.0.0"    dependencies:    flutter:      sdk: flutter      # The following adds the Cupertino Icons font to your application.    # Use with the CupertinoIcons class for iOS style icons.    cupertino_icons: ^0.1.3    # Please use the latest version of agora_rtc_engine    agora_rtc_engine: ^5.2.0    permission_handler: ^8.3.0

Add the following line in the /android/build.gradle file of your project:

allprojects {      repositories {          ...          maven { url 'https://www.jitpack.io' }      }  }

Import Packages:

import 'package:agora_uikit/agora_uikit.dart';  import 'package:flutter/material.dart';

Flutter Code:

Below is a function that can be used as a callback of a button widget (onPressed):

Dart
class VideoCallScreen extends StatefulWidget {   const VideoCallScreen({Key? key}) : super(key: key);    @override   State<VideoCallScreen> createState() => _VideoCallScreenState(); }  class _VideoCallScreenState extends State<VideoCallScreen> {   final AgoraClient _client = AgoraClient(       agoraConnectionData: AgoraConnectionData(     appId: '<YOUR APP ID>',     channelName: '<YOUR CHANNEL NAME>',     tempToken:         '<YOUR TOKEN>',   ));    @override   void initState() {     super.initState();     _initAgora();   }    Future<void> _initAgora() async {     await _client.initialize();   }    @override   Widget build(BuildContext context) {     return WillPopScope(       onWillPop: () async => false,       child: Scaffold(           appBar: AppBar(             title: const Text('Video Call'),           ),           body: SafeArea(             child: Stack(               children: [                 AgoraVideoViewer(                   client: _client,                   layoutType: Layout.floating,                   showNumberOfUsers: true,                 ),                 AgoraVideoButtons(                   client: _client,                   enabledButtons: const [                     BuiltInButtons.toggleCamera,                     BuiltInButtons.switchCamera,                     BuiltInButtons.callEnd,                     BuiltInButtons.toggleMic,                   ],                 )               ],             ),           )),     );   } } 

Output:


Next Article
How to Build a Flutter App to Display Device Details?

N

neelkothariak
Improve
Article Tags :
  • Project
  • Flutter

Similar Reads

  • How to Build a ToDo Application in Flutter?
    Flutter offers a stable framework for constructing richly UI-driven cross-platform applications. In this article, we will learn to build a ToDo Flutter Application. What is the ToDo Application?The ToDo application helps users manage and organize their tasks and responsibilities more easily. Managin
    6 min read
  • Building a Movie Database App in Flutter
    In this tutorial, we'll create a Flutter app that fetches movie data from an API, displays details such as ratings and reviews, and allows users to save their favorite movies locally using SQLite. This Application will demonstrate API integration, state management, and local data persistence. Applic
    12 min read
  • How to Build Advance Quiz App in Flutter?
    This is a quiz app using Flutter and API. The working of this application is very simple,  here we have two screens: screen one and screen two. Screen one is the stateless screen which means that it will not respond to any change on the screen. The second screen, is a stateful widget which means tha
    10 min read
  • How to Create a Desktop Window Application in Flutter?
    The Flutter team recently released Flutter version 2.10 with Desktop support. Desktop support allows you to compile Flutter source code to a native Windows, macOS, or Linux desktop app. Flutter’s desktop support also extends to plugins—you can install existing plugins that support the Windows, macOS
    3 min read
  • How to Build a Flutter App to Display Device Details?
    Here we are going to build an android application using flutter that displays device information on which it is running. To display information about the device we are going to use a package called device_info_plus. Create Flutter Project: Now remove all the existing code and remove the test folder
    5 min read
  • Flutter - Building News Reader App
    In today's fast-paced world, staying informed is essential, and mobile applications have become a popular medium for accessing news. In this article, we'll guide you through building a News Reader App step by step using Flutter, a powerful and versatile framework for creating cross-platform applicat
    5 min read
  • How to Build a Bitcoin Tracker Flutter App?
    In this article, we will be building a Bitcoin Tracker Project using Flutter and Dart . The application will display the current rates of Bitcoin in different countries using Bitcoin API. There are many free APIs available and for this project, we will be using API by Coinlayer. The API will return
    3 min read
  • How to Add Firebase to Flutter App?
    Firebase is a product of Google that helps developers to build, manage, and grow their apps easily. It helps developers to build their apps faster and more securely. No programming is required on the Firebase side which makes it easy to use its features more efficiently. It provides services to Andr
    3 min read
  • How to Write TestCases For API Calls in Flutter?
    Here we are going to a built app that calls an API and write test cases for it before we dive into it let’s go through some basic concepts. Software testing is a process in which we test code to ensure that it produces the excepted results at any given instance. Flutter tests consist of: Unit test -
    8 min read
  • Creating a Simple Application in Flutter
    Flutter is an open-source cross-platform mobile application development SDK created by Google. It is highly user-friendly and builds high-quality mobile applications. The intention behind this article is to guide readers through the process of building an application through Flutter by creating a si
    5 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences