omni_jitsi_meet 1.0.0
omni_jitsi_meet: ^1.0.0 copied to clipboard
Jitsi Meet Plugin - A plugin for integrating open source Jitsi Meet API in flutter. Jitsi Meet is secure, fully featured and allows completely free video conferencing made with https://jitsi.org, a co [...]
example/lib/main.dart
import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:omni_jitsi_meet/jitsi_meet.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(debugShowCheckedModeBanner: false, home: Meeting());
}
}
class Meeting extends StatefulWidget {
@override
_MeetingState createState() => _MeetingState();
}
class _MeetingState extends State<Meeting> {
final serverText = TextEditingController();
final roomText = TextEditingController(text: "omni1234ASMD");
final subjectText = TextEditingController(text: "Subject1");
final nameText = TextEditingController(text: "User1");
final emailText = TextEditingController(text: "fake1@email.com");
final iosAppBarRGBAColor =
TextEditingController(text: "#0080FF80"); //transparent blue
bool? isAudioOnly = true;
bool? isAudioMuted = true;
bool? isVideoMuted = true;
@override
Widget build(BuildContext context) {
double width = MediaQuery.of(context).size.width;
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: Container(
padding: const EdgeInsets.symmetric(
horizontal: 16.0,
),
child: kIsWeb
? Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
width: width * 0.30,
child: meetConfig(),
),
Container(
width: width * 0.60,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Card(
color: Colors.white54,
child: SizedBox(
width: width * 0.60 * 0.70,
height: width * 0.60 * 0.70,
child: JitsiMeetConferencing(
extraJS: [
// extraJs setup example
'<script src="https://code.jquery.com/jquery-3.5.1.slim.js" integrity="sha256-DrT5NfxfbHvMHux31Lkhxg42LY6of8TaYyK50jnxRnM=" crossorigin="anonymous"></script>'
],
),
)),
))
],
)
: meetConfig(),
),
),
);
}
Widget meetConfig() {
return SingleChildScrollView(
child: Column(
children: <Widget>[
SizedBox(
height: 16.0,
),
TextField(
controller: serverText,
decoration: InputDecoration(
border: OutlineInputBorder(),
labelText: "Server URL",
hintText: "Hint: Leave empty for meet.jitsi.si"),
),
SizedBox(
height: 14.0,
),
TextField(
controller: roomText,
decoration: InputDecoration(
border: OutlineInputBorder(),
labelText: "Room",
),
),
SizedBox(
height: 14.0,
),
TextField(
controller: subjectText,
decoration: InputDecoration(
border: OutlineInputBorder(),
labelText: "Subject",
),
),
SizedBox(
height: 14.0,
),
TextField(
controller: nameText,
decoration: InputDecoration(
border: OutlineInputBorder(),
labelText: "Display Name",
),
),
SizedBox(
height: 14.0,
),
TextField(
controller: emailText,
decoration: InputDecoration(
border: OutlineInputBorder(),
labelText: "Email",
),
),
SizedBox(
height: 14.0,
),
TextField(
controller: iosAppBarRGBAColor,
decoration: InputDecoration(
border: OutlineInputBorder(),
labelText: "AppBar Color(IOS only)",
hintText: "Hint: This HAS to be in HEX RGBA format"),
),
SizedBox(
height: 14.0,
),
CheckboxListTile(
title: Text("Audio Only"),
value: isAudioOnly,
onChanged: _onAudioOnlyChanged,
),
SizedBox(
height: 14.0,
),
CheckboxListTile(
title: Text("Audio Muted"),
value: isAudioMuted,
onChanged: _onAudioMutedChanged,
),
SizedBox(
height: 14.0,
),
CheckboxListTile(
title: Text("Video Muted"),
value: isVideoMuted,
onChanged: _onVideoMutedChanged,
),
Divider(
height: 48.0,
thickness: 2.0,
),
SizedBox(
height: 64.0,
width: double.maxFinite,
child: ElevatedButton(
onPressed: () {
_joinMeeting();
},
child: Text(
"Join Meeting",
style: TextStyle(color: Colors.white),
),
style: ButtonStyle(
backgroundColor:
MaterialStateColor.resolveWith((states) => Colors.blue)),
),
),
SizedBox(
height: 48.0,
),
],
),
);
}
_onAudioOnlyChanged(bool? value) {
setState(() {
isAudioOnly = value;
});
}
_onAudioMutedChanged(bool? value) {
setState(() {
isAudioMuted = value;
});
}
_onVideoMutedChanged(bool? value) {
setState(() {
isVideoMuted = value;
});
}
_joinMeeting() async {
String? serverUrl = serverText.text.trim().isEmpty ? null : serverText.text;
Map<FeatureFlagEnum, dynamic> featureFlags = {
FeatureFlagEnum.ADD_PEOPLE_ENABLED: false,
FeatureFlagEnum.ANDROID_SCREENSHARING_ENABLED: false,
FeatureFlagEnum.AUDIO_FOCUS_DISABLED: false,
FeatureFlagEnum.AUDIO_MUTE_BUTTON_ENABLED: true,
FeatureFlagEnum.AUDIO_ONLY_BUTTON_ENABLED: false,
FeatureFlagEnum.CALENDAR_ENABLED: false,
FeatureFlagEnum.CAR_MODE_ENABLED: false,
FeatureFlagEnum.CLOSE_CAPTIONS_ENABLED: true,
FeatureFlagEnum.CONFERENCE_TIMER_ENABLED: false,
FeatureFlagEnum.CHAT_ENABLED: false,
FeatureFlagEnum.FILMSTRIP_ENABLED: true,
FeatureFlagEnum.FULLSCREEN_ENABLED: true,
FeatureFlagEnum.HELP_BUTTON_ENABLED: false,
FeatureFlagEnum.INVITE_ENABLED: false,
FeatureFlagEnum.IOS_RECORDING_ENABLED: false,
FeatureFlagEnum.IOS_SCREENSHARING_ENABLED: false,
FeatureFlagEnum.SPEAKERSTATS_ENABLED: false,
FeatureFlagEnum.KICK_OUT_ENABLED: false,
FeatureFlagEnum.LIVE_STREAMING_ENABLED: false,
FeatureFlagEnum.LOBBY_MODE_ENABLED: false,
FeatureFlagEnum.MEETING_NAME_ENABLED: false,
FeatureFlagEnum.MEETING_PASSWORD_ENABLED: false,
FeatureFlagEnum.NOTIFICATIONS_ENABLED: false,
FeatureFlagEnum.OVERFLOW_MENU_ENABLED: true,
FeatureFlagEnum.PIP_ENABLED: false,
FeatureFlagEnum.PREJOIN_PAGE_ENABLED: false,
FeatureFlagEnum.RAISE_HAND_ENABLED: false,
FeatureFlagEnum.REACTIONS_ENABLED: true,
FeatureFlagEnum.RECORDING_ENABLED: false,
FeatureFlagEnum.REPLACE_PARTICIPANT: false,
FeatureFlagEnum.RESOLUTION: FeatureFlagVideoResolution.HD_RESOLUTION,
FeatureFlagEnum.SECURITY_OPTIONS_ENABLED: false,
FeatureFlagEnum.SERVER_URL_CHANGE_ENABLED: false,
FeatureFlagEnum.SETTINGS_ENABLED: false,
FeatureFlagEnum.TILE_VIEW_ENABLED: true,
FeatureFlagEnum.TOOLBOX_ALWAYS_VISIBLE: true,
FeatureFlagEnum.TOOLBOX_ENABLED: true,
FeatureFlagEnum.VIDEO_MUTE_BUTTON_ENABLED: true,
FeatureFlagEnum.VIDEO_SHARE_BUTTON_ENABLED: false,
FeatureFlagEnum.WELCOME_PAGE_ENABLED: false,
};
if (!kIsWeb && Platform.isAndroid) {
featureFlags[FeatureFlagEnum.CALL_INTEGRATION_ENABLED] = false;
}
// Define meetings options here
var options = JitsiMeetingOptions(room: roomText.text)
..serverURL = serverUrl
..subject = subjectText.text
..userDisplayName = nameText.text
..userEmail = emailText.text
..iosAppBarRGBAColor = iosAppBarRGBAColor.text
..audioOnly = isAudioOnly
..audioMuted = isAudioMuted
..videoMuted = isVideoMuted
..featureFlags.addAll(featureFlags)
..webOptions = {
"roomName": roomText.text,
"width": "100%",
"height": "100%",
"enableWelcomePage": false,
"disableInviteFunctions": true,
"prejoinPageEnabled": false,
"chromeExtensionBanner": null,
"interfaceConfigOverwrite": {
"ENABLE_WELCOME_PAGE": false,
"ENABLE_PREJOIN_PAGE": false,
"ENABLE_CLOSE_PAGE": false,
"ENABLE_BREAKOUT_ROOMS": false,
"ENABLE_RECORDING": false,
"SHOW_CHROME_EXTENSION_BANNER": false,
"CLOSE_PAGE_GUEST_HINT": false,
"MOBILE_APP_PROMO": false,
"SHOW_PROMOTIONAL_CLOSE_PAGE": false
},
"userInfo": {"email": emailText.text, "displayName": nameText.text}
};
debugPrint("CUSTOM_JITSI: JitsiMeetingOptions: $options");
await JitsiMeet.joinMeeting(
options,
listener: JitsiMeetingListener(
onOpened: () {
debugPrint("JitsiMeetingListener - onOpened");
},
onClosed: () {
debugPrint("JitsiMeetingListener - onClosed");
},
onError: (error) {
debugPrint("JitsiMeetingListener - onError: error: $error");
},
onConferenceWillJoin: (url) {
debugPrint(
"JitsiMeetingListener - onConferenceWillJoin: url: $url");
},
onConferenceJoined: (url) {
debugPrint("JitsiMeetingListener - onConferenceJoined: url:$url");
},
onConferenceTerminated: (url, error) {
debugPrint(
"JitsiMeetingListener - onConferenceTerminated: url: $url, error: $error");
},
onParticipantLeft: (participantId) {
debugPrint(
"JitsiMeetingListener - onParticipantLeft: $participantId");
},
onParticipantJoined: (email, name, role, participantId) {
debugPrint("JitsiMeetingListener - onParticipantJoined: "
"email: $email, name: $name, role: $role, "
"participantId: $participantId");
},
onAudioMutedChanged: (muted) {
debugPrint(
"JitsiMeetingListener - onAudioMutedChanged: muted: $muted");
},
onVideoMutedChanged: (muted) {
debugPrint(
"JitsiMeetingListener - onVideoMutedChanged: muted: $muted");
},
onScreenShareToggled: (participantId, isSharing) {
debugPrint("JitsiMeetingListener - onScreenShareToggled: "
"participantId: $participantId, isSharing: $isSharing");
},
genericListeners: [
JitsiGenericListener(
eventName: 'readyToClose',
callback: (dynamic message) {
debugPrint("JitsiMeetingListener - readyToClose callback");
}),
]),
);
}
}