jitsi_meet 0.1.0 jitsi_meet: ^0.1.0 copied to clipboard
Jitsi Meet Plugin
import 'dart:math';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:jitsi_meet/jitsi_meet.dart';
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
var roomText = TextEditingController(text: "plugintestroom");
var subjectText = TextEditingController(text: "My Plugin Test Meeting");
var nameText = TextEditingController(text: "Plugin Test User");
var emailText = TextEditingController(text: "fake@email.com");
var isAudioOnly = true;
var isAudioMuted = true;
var isVideoMuted = true;
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
actions: <Widget>[
PopupMenuButton(
icon: Icon(Icons.settings),
offset: Offset.fromDirection(pi / 2, 48.0),
itemBuilder: (context) => <PopupMenuEntry>[
PopupMenuItem(
child: FlatButton(
child: Text("Change Server URL (TODO)"),
)),
PopupMenuItem(
child: FlatButton(
child: Text("Use Token (TODO)"),
)),
]),
],
),
body: Container(
padding: const EdgeInsets.symmetric(
horizontal: 16.0,
),
child: SingleChildScrollView(
child: Column(
children: <Widget>[
SizedBox(
height: 24.0,
),
TextField(
controller: roomText,
decoration: InputDecoration(
border: OutlineInputBorder(),
labelText: "Room",
),
),
SizedBox(
height: 16.0,
),
TextField(
controller: subjectText,
decoration: InputDecoration(
border: OutlineInputBorder(),
labelText: "Subject",
),
),
SizedBox(
height: 16.0,
),
TextField(
controller: nameText,
decoration: InputDecoration(
border: OutlineInputBorder(),
labelText: "Display Name",
),
),
SizedBox(
height: 16.0,
),
TextField(
controller: emailText,
decoration: InputDecoration(
border: OutlineInputBorder(),
labelText: "Email",
),
),
SizedBox(
height: 16.0,
),
CheckboxListTile(
title: Text("Audio Only"),
value: isAudioOnly,
onChanged: _onAudioOnlyChanged,
),
SizedBox(
height: 16.0,
),
CheckboxListTile(
title: Text("Audio Muted"),
value: isAudioMuted,
onChanged: _onAudioMutedChanged,
),
SizedBox(
height: 16.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: RaisedButton(
onPressed: () {
_joinMeeting();
},
child: Text(
"Join Meeting",
style: TextStyle(color: Colors.white),
),
color: 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 {
try {
var options = JitsiMeetingOptions()
..room = roomText.text
..subject = subjectText.text
..userDisplayName = nameText.text
..userEmail = emailText.text
..audioOnly = isAudioOnly
..audioMuted = isAudioMuted
..videoMuted = isVideoMuted;
await JitsiMeet.joinMeeting(options);
} catch (error) {
debugPrint("error: $error");
}
}
}