oa_agora_video

Last updated:

0 purchases

oa_agora_video Image
oa_agora_video Images
Add to Cart

Description:

oa agora video

A Flutter package for integrating video calling functionality using the Agora RTC Engine.
This package provides a simple and customizable solution for adding video call capabilities
to your Flutter applications. It includes features such as muting audio/video, viewing
participants, and adding new participants to the call.
Features #

Integrate video calling functionality into your Flutter apps.
Customize video call UI according to your app's design.
Mute/unmute audio during the call.
Pause/play video during the call.
View participants' video streams.
Add new participants to the ongoing call.

Getting started #
See the required device permissions from the AndroidManifest.xml file.

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<!-- The Agora SDK requires Bluetooth permissions in case users are using Bluetooth devices. -->
<uses-permission android:name="android.permission.BLUETOOTH" />
<!-- For Android 12 and above devices, the following permission is also required. -->
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />

copied to clipboard
For IOS MACOS:
For the latest permission settings, please refer to the documentation at https://docs.agora.io/en/video-calling/get-started/get-started-sdk?platform=ios#project-setup

copied to clipboard
Open the Info.plist and add:
Privacy - Microphone Usage Description,and add some description into the Value column.
Privacy - Camera Usage Description, and add some description into the Value column.
dependencies:
oa_agora_videocall: ^x.x.x
agora_rtc_engine: ^x.x.x
permission_handler: ^x.x.x
copied to clipboard
Usage #

import 'package:flutter/material.dart';
import 'package:oa_agora_video/oa_agora_video.dart';
import 'package:agora_rtc_engine/agora_rtc_engine.dart';
import 'package:permission_handler/permission_handler.dart';

class VideoPackage extends StatefulWidget {
const VideoPackage({Key? key}) : super(key: key);

@override
State<VideoPackage> createState() => _VideoPackageState();
}

const appId = "Your app id";
const gettoken =
"Your token";
const channelname = "Your channel name";

class _VideoPackageState extends State<VideoPackage> {
int? _remoteUid;
bool _localUserJoined = false;
bool _muteLocalAudio = false;
bool _muteLocalVideo = false;
late RtcEngine _engine;

@override
void initState() {
super.initState();
initAgora();
}

Future<void> initAgora() async {
await [Permission.microphone, Permission.camera].request();

_engine = createAgoraRtcEngine();
await _engine.initialize(const RtcEngineContext(
appId: appId,
channelProfile: ChannelProfileType.channelProfileLiveBroadcasting,
));

_engine.registerEventHandler(
RtcEngineEventHandler(
onJoinChannelSuccess: (RtcConnection connection, int elapsed) {
debugPrint("Host ${connection.localUid} joined");
setState(() {
_localUserJoined = true;
});
},
onUserJoined: (RtcConnection connection, int remoteUid, int elapsed) {
debugPrint("New user $remoteUid joined");
setState(() {
_remoteUid = remoteUid;
});
},
onUserOffline: (RtcConnection connection, int remoteUid,
UserOfflineReasonType reason) {
debugPrint("New user $remoteUid left channel");
setState(() {
_remoteUid = null;
});
},
onTokenPrivilegeWillExpire: (RtcConnection connection, String token) {
debugPrint(
'[onTokenPrivilegeWillExpire] connection: ${connection.toJson()}, token: ${gettoken}');
},
),
);

await _engine.setClientRole(role: ClientRoleType.clientRoleBroadcaster);
await _engine.enableVideo();
await _engine.startPreview();

await _engine.joinChannel(
token: gettoken,
channelId: channelname,
uid: 0,
options: const ChannelMediaOptions(),
);
}

@override
void dispose() {
super.dispose();
_dispose();
}

Future<void> _dispose() async {
await _engine.leaveChannel();
await _engine.release();
}

void _toggleMuteLocalAudio() {
setState(() {
_muteLocalAudio = !_muteLocalAudio;
});
_engine.muteLocalAudioStream(_muteLocalAudio);
}

void _toggleMuteLocalVideo() {
setState(() {
_muteLocalVideo = !_muteLocalVideo;
});

if (_muteLocalVideo) {
_engine.enableLocalVideo(false);
} else {
_engine.enableLocalVideo(true);
}
}

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('OASolutions Video Call'),
backgroundColor: Colors.blue, // Change background color

),
body: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Expanded(
child: Stack(
children: [
Center(
child: _remoteVideo(),
),
Align(
alignment: Alignment.topLeft,
child: SizedBox(
width: 100,
height: 150,
child: Center(
child: _localUserJoined
? AgoraVideoView(
controller: VideoViewController(
rtcEngine: _engine,
canvas: const VideoCanvas(uid: 0),
),
)
: CircularProgressIndicator(),
),
),
),
],
),
),
Padding(
padding: const EdgeInsets.all(16.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [

// Viewing participants details
IconButton(
icon: Icon(Icons.person),
onPressed: () {
// Add functionality for the professional button
},
),

// Adding new participant to the call
IconButton(
icon: Icon(Icons.add_box),
onPressed: () {
// Add functionality for the professional button
},
),

IconButton(
icon: Icon(_muteLocalAudio ? Icons.mic_off : Icons.mic),
onPressed: _toggleMuteLocalAudio,
),
IconButton(
icon: Icon(_muteLocalVideo ? Icons.pause : Icons.play_arrow), // Change icon
onPressed: _toggleMuteLocalVideo,
),
],
),
),
],
),
);
}


Widget _remoteVideo() {
if (_remoteUid != null) {
return AgoraVideoView(
controller: VideoViewController.remote(
rtcEngine: _engine,
canvas: VideoCanvas(uid: _remoteUid),
connection: RtcConnection(channelId: channelname),
),
);
} else {
return const Center(
child: Text(
'Waiting for other user to join',
textAlign: TextAlign.center,
),
);
}
}
}

copied to clipboard
Additional information #
The oa_agora_videocall package is a Flutter package designed to integrate video calling functionality using the Agora RTC Engine. It provides a simple and customizable solution for adding video call capabilities to your Flutter applications.
Features #

Mute/unmute audio during the call.
Pause/play video during the call.
View participants' video streams.
Add new participants to the ongoing call.

More Information #

GitHub Repository: You can find the source code, documentation, and examples for this package on GitHub.
Issues and Contributions: To report issues, request features, or contribute to the package, please visit the issue tracker.

For more information, please refer to the package documentation or explore the GitHub repository. #
oa_agora_videocall #
A Flutter package for integrating video calling functionality using the Agora RTC Engine. This package provides a simple and customizable solution for adding video call capabilities to your Flutter applications.
Features #

Integrate video calling functionality into your Flutter apps.
Customize video call UI according to your app's design.
Mute/unmute audio during the call.
Pause/play video during the call.
View participants' video streams.
Add new participants to the ongoing call.

Getting Started #
To start using this package, add it to your pubspec.yaml file:
dependencies:
oa_agora_videocall: ^x.x.x
agora_rtc_engine: ^x.x.x
permission_handler: ^x.x.x

Replace ^x.x.x with the latest version of the package.

For detailed usage instructions, see the package documentation.

import 'package:oa_agora_video/oa_agora_video.dart';




copied to clipboard

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.