We will keep the UI as minimalist as possible. Now, the fun part is displaying the video and stats for the user and seeing it all work together. rtcStats: Gets triggered every two seconds and returns the statistics of the callįor these four methods, we are going to set some local variables: first, a boolean to tell us whether the current user has successfully joined ( _localUserJoined) then an integer for the user ID of the remote user who joins the channel (when the user leaves the channel we will set this id back to null) and finally, we will update our local stats variable every two seconds with fresh information.Īll the logic for the app is completed.userOffline: Gets triggered when a remote user leaves the same channel that the current user is on.userJoined: Gets triggered when a remote user joins the same channel that the current user is on.joinChannelSuccess: Gets triggered when the current user of the app successfully joins a channel.Agora supports a huge list of events, but we are going to use only four of them for our simple app: To do this, we call the setEventHandler method on the engine and we can define what we want to happen on specific events. Next comes the main logic within the app: the event handler for any events that occur on the engine. We will start with a simple stateful widget layout with a Scaffold inside a Material App like this: Once again, we will be using one file to keep things as simple as possible. Now all the preconditions are set up, and we are ready to jump to the actual code. For more information about token-based authentication in the Agora platform, see this guide: Building the App Token authentication is recommended for all RTE apps running in production environments. It is not intended for production environments. Note: This project is meant for reference purposes and development environments. In your app, create global variables named appId and token and set them to the values retrieved from Agora. There you will find your appId, and you can generate a temporary token. The first step is to create an Agora project. For this project, we will use a temporary token. The last preparation step will be to get the appId and the token so we can use Agora securely. With these packages added, your dependencies should look like this: permission_handler: Assists with checking whether permissions are granted for using the camera and the microphone for this app but can be used for any other permissions on the device.agora_rtc_engine: A wrapper for the Agora SDK that is made for Flutter.Once you have the project ready, you will need to add the necessary packages into the pubspec.yaml file. The next step for any Flutter project is running flutter create agora_project An Agora Developer Account - Sign Up Hereįor this project, we will be working with only the main file.Agora can do much more, but many of us learn best by something very basic and building up from that. In this article, we will cover how to create a simple video call application with in-call statistics. Using the Agora Flutter SDK, which can be installed with a plugin from pub.dev, you can connect people via voice, video, and other mediums. Adding video call capabilities to your current app will allow users to stay on your app longer, help connect the users to connect to one another, and increase the value that your app provides. Clearly, remote communication will continue to be a big part of our future. When the pandemic hit in 2020, remote communication became an even more vital part of the way we communicate.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |