Zego's audio and video Flutter SDK provides live video and real-time audio and video services.
Learn more about the solution: https://www.zego.im
https://flutter.dev/docs/get-started/install
-
Android Studio:
Preferences
->Plugins
, search for theFlutter
plugin to download, configure the first step to download the Flutter SDK path in the plugin. -
Visual Code: Search for the
Flutter
extension in the app store and download
After configuring the flutter environment in any of the above development environments, execute the flutter doctor
on the command line and complete the related undownloaded dependencies according to the prompts.
Log in to ZEGO Official Website to register an account, select a scenario according to your actual business needs, and obtain AppID and App Sign for initializing the SDK.
Open the pubspec.yaml
in the project to be imported and add the zegoliveroom_plugin
dependency:
- Dependent in pub form:
dependencies:
flutter:
sdk: flutter
zegoliveroom_plugin: ^1.2.5
- Dependent in git form:
dependencies:
flutter:
sdk: flutter
zegoliveroom_plugin:
git:
url: git://github.com/zegoim/zego-flutter-sdk.git
- Dependent in git form and specify the branch:
dependencies:
flutter:
sdk: flutter
zegoliveroom_plugin:
url: git://github.com/zegoim/zego-flutter-sdk.git
ref: branch_name
import 'package:flutter/material.dart';
import 'package:zegoliveroom_plugin/zegoliveroom_plugin.dart';
void main() => runApp(new MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => new _MyAppState();
}
class _MyAppState extends State<MyApp> {
// Fill in the AppID actually obtained from the official website
final int appID = 00000000;
// Fill in the AppSign actually obtained from the official website
final String appSign = '0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,'
'0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,'
'0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,'
'0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00';
String version = '';
@override
void initState() {
super.initState();
// get SDK version
ZegoLiveRoomPlugin.getSdkVersion().then((ver) {
setState({
version = ver;
});
});
// init SDK
ZegoLiveRoomPlugin.initSDK(appID, appSign);
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Zego Plugin example app'),
),
body: Center(
child: Text('Version: $version'),
),
),
);
}
}
Please refer to the API usage for more features.
Reference ZegoLiveRoomPlugin API Reference
1. Solve the problem of compiling errors of ZegoLiveRoomApi-AudioIO
and audio_in_output
modules on iOS platform
Open the iOS project file Runner. xcworkspace
-> Build Settings
, change Compile Sources As
to Objective-C++
, recompile.
Compilation with the simulator is not supported, please use real device debugging for best results.
3. iOS uses Platform View error: [VERBOSE-2:platform_view_layer.cc(28)] Trying to embed a platform view but the PaintContext does not support embedding
Open the iOS project that requires Platform View and add the field io.flutter.embedded_views_preview
to Info.plist
with a value of YES
.
4. fatal error: lipo: -extract armv7 specified but fat file: [...] does not contain that architecture
Usually occurs when switching iOS devices, which can be resolved by deleting the "flutter-project-path/build/" and "flutter-project-path/ios/DerivedData/" directories.
5. Android building release crashes with NoClassDefFoundError
when flutter is upgraded to 1.10 or above
Flutter is enabled obfuscation by default in version 1.10 or above. Please add the following line in app/proguard-rules.pro
to prevent the Zego SDK obfuscation.
-keep class com.zego.**{*;}