Search…
In Flutter
Flutter is Google's free and open-source UI framework for creating native mobile applications.
Before starting, you will need to add the corresponding permissions to be able to access both the camera and microphone as described in the Android and iOS sections.
We recommend using the flutter_inappwebview and permission_handler modules to handle media permissions in the webview. Update the settings in your iOS and Android projects to match the requirements. Note that there is a known issue to show the keyboard in Android webviews.
Finally, add the WebView component to your code, setup the properties and fill the room URL and parameters. Here is a short example:
Dart
1
import 'package:flutter/material.dart';
2
import 'dart:io' show Platform;
3
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
4
import 'package:permission_handler/permission_handler.dart';
5
6
var _url = ""; // Replace by your own
7
8
void main() => runApp(MyApp());
9
10
class MyApp extends StatelessWidget {
11
@override
12
Widget build(BuildContext context) {
13
if (Platform.isAndroid) {
14
_url += '?skipMediaPermissionPrompt';
15
}
16
return MaterialApp(
17
home: InAppWebViewPage(),
18
);
19
}
20
}
21
22
class InAppWebViewPage extends StatefulWidget {
23
InAppWebViewPage();
24
25
@override
26
_InAppWebViewPageState createState() => new _InAppWebViewPageState();
27
}
28
29
class _InAppWebViewPageState extends State<InAppWebViewPage> {
30
_InAppWebViewPageState();
31
32
@override
33
Widget build(BuildContext context) {
34
return Scaffold(
35
appBar: AppBar(title: Text("Meeting")),
36
body: Container(
37
child: Column(children: <Widget>[
38
Expanded(
39
child: Container(
40
child: InAppWebView(
41
initialUrlRequest: URLRequest(url: Uri.parse(_url)),
42
initialOptions: InAppWebViewGroupOptions(
43
crossPlatform: InAppWebViewOptions(
44
mediaPlaybackRequiresUserGesture: false,
45
),
46
ios: IOSInAppWebViewOptions(
47
allowsInlineMediaPlayback: true,
48
)),
49
androidOnPermissionRequest: (InAppWebViewController controller,
50
String origin, List<String> resources) async {
51
await Permission.camera.request();
52
await Permission.microphone.request();
53
return PermissionRequestResponse(
54
resources: resources,
55
action: PermissionRequestResponseAction.GRANT);
56
},
57
),
58
),
59
),
60
])));
61
}
62
}
Copied!
Copy link