stringee_plugin 1.3.2
stringee_plugin: ^1.3.2 copied to clipboard
A Flutter plugin for Stringee voice and video calls, chat, live chat, and video conferencing on Android and iOS.
Stringee Flutter #
A Flutter plugin for Android and iOS that provides access to Stringee API services. It can be integrated into Flutter applications that need Stringee communication features.
Features #
- Voice call
- Video call
- Chat 1-1, chat group
- Video conference
Getting Started #
Check out our comprehensive Example provided with this plugin.
To use this package, add the dependency to your pubspec.yaml file.
dependencies:
flutter:
sdk: flutter
stringee_plugin: ^1.3.2
See the available versions and release notes in the Changelog.
Android requirements #
- Android
minSdk21 or later - Android SDK Platform 36 installed
The plugin is compiled with Android API 36. If your application declares its own compileSdk, set
it to 36 or later:
android {
compileSdk = 36
}
Basic usage #
Create one StringeeClient, subscribe to its event stream, and connect it with an access token
generated by your server:
final client = StringeeClient();
final clientSubscription = client.eventStreamController.stream.listen((event) {
switch (event['eventType']) {
case StringeeClientEvents.didConnect:
print('Connected as ${client.userId}');
break;
case StringeeClientEvents.requestAccessToken:
// Fetch a new token from your server, then call client.connect(newToken).
break;
case StringeeClientEvents.incomingCall:
final call = event['body'] as StringeeCall;
// Present incoming-call UI and call call.initAnswer().
break;
case StringeeClientEvents.incomingCall2:
final call = event['body'] as StringeeCall2;
// Present incoming-call UI and call call.initAnswer().
break;
}
});
await client.connect(accessToken);
Create and observe an outgoing call:
final call = StringeeCall(client);
final callSubscription = call.eventStreamController.stream.listen((event) {
if (event['eventType'] == StringeeCallEvents.didChangeSignalingState) {
final state = event['body'] as StringeeSignalingState;
print('Signaling state: $state');
}
});
final result = await call.makeCallFromParams(
MakeCallParams(
fromUserId,
toUserId,
isVideoCall: true,
videoQuality: VideoQuality.hd,
),
);
Video rendering #
Use StringeeVideoView for Call or Call2 video. The first argument is the call ID; set isLocal
to true for the local camera and false for the remote stream:
Stack(
children: [
StringeeVideoView(
call.id!,
false,
scalingType: ScalingType.fill,
),
Positioned(
right: 16,
top: 16,
width: 120,
height: 160,
child: StringeeVideoView(
call.id!,
true,
isMirror: true,
scalingType: ScalingType.fit,
),
),
],
)
On Android, the widget may be created before the native local or remote renderer is ready. The plugin keeps the requested mirror and scaling options, then attaches the renderer when the stream becomes available. A native renderer can belong to only one Android view, so rebuilding it at a new location moves it from the previous container. Removing the Flutter widget clears its pending attachment safely.
For video conference tracks, use track.attach(...), which returns a StringeeVideoView bound to
that track:
final remoteView = track.attach(
scalingType: ScalingType.fit,
isMirror: false,
);
Release object-level subscriptions when they are no longer needed:
await callSubscription.cancel();
call.destroy();
await clientSubscription.cancel();
await client.disconnect();
StringeeCall2, StringeeChat, and StringeeVideoRoom expose their own event streams. Call their
destroy() method after use so the plugin can close the corresponding stream subscription.
API documentation #
Public Flutter APIs include DartDoc for classes, constructors, fields, event values, and methods. Generate browsable API documentation locally with:
dart doc --validate-links
The generated site is written to doc/api/index.html. Android bridge classes and methods include
JavaDoc that is available in IDE source documentation.
Check out our getting-started guides:
- Getting started with Stringee Call API using Flutter Plugin
- Getting started with Stringee Call2 API using Flutter Plugin
- Getting started with Stringee Chat API using Flutter Plugin
- Getting started with Stringee Video Conference API using Flutter Plugin
License #
This project is licensed under the BSD 3-Clause License - see the LICENSE file for details.