simli_client 1.0.0 simli_client: ^1.0.0 copied to clipboard
Simli Client is a Flutter package that integrates with the Simli API, enabling real-time, low-latency streaming avatars. Leverages WebRTC for seamless video rendering and peer connections, ideal for v [...]
Simli Client for Flutter #
The Simli Client Flutter package integrates with the Simli API to deliver real-time, low-latency streaming avatars. These avatars can be used in various applications, such as customer service bots, virtual assistants, and more. This package leverages WebRTC technology for video rendering, peer connections, and data channels, ensuring a seamless, high-performance experience.
Features #
This package supports the following parameters and methods:
Parameters #
SimliClient
supports the following parameters during initialization:
Name | Type | Description |
---|---|---|
apiKey | String | The API key used for authenticating API requests. |
faceId | String | Identifies the face to use for the session. |
handleSilence | bool | Optional. Determines whether silence handling is enabled. |
Visit the Simli website to obtain your API key and face ID. simli.com
Getting Started #
Installing #
-
Add the dependency to
pubspec.yaml
.Get the latest version from the 'Installing' tab on pub.dev.
dependencies: simli_client: <latest-version>
-
Run the following command:
flutter pub get
-
Import the package:
import 'package:simli_client/simli_client.dart';
Implementation #
-
Initialize the Simli client:
final SimliClient simliClient = SimliClient(apiKey: ApiKeys.simliApiKey, faceId: faceId);
-
Call the
start
function to establish a connection with the server and create a peer connection:simliClient.start();
-
Use
RTCVideoView
in the widget tree to display the live avatar:RTCVideoView( simliClient.videoRenderer!, mirror: false, placeholderBuilder: (context) => const Center(child: CircularProgressIndicator()), );
-
Once the connection is established, you can send custom PCM16 audio with a 16,000 sample rate to the server. The avatar will start speaking using the provided audio. The audio data must be in
Uint8List
format:simliClient.sendAudioData(data);
Additional Methods and Parameters #
This package also includes additional methods and parameters to help you build a robust application:
Name | Type | Description |
---|---|---|
state | SimliState | Returns the current state of the client. |
stateNotifier | ValueNotifier | Notifies about the SimliState. |
onConnection | VoidCallback | Callback when the connection is established. |
onFailed | Function(SimliError error) | Callback when the connection fails. |
onDisconnected | VoidCallback | Callback when the connection is disconnected. |
isSpeaking | bool | Returns true if the avatar is speaking. |
isSpeakingNotifier | ValueNotifier | Notifies about the speaking status. |
audioLevelNotifier | ValueNotifier | Notifies about the audio level of the avatar. |
Preview #
Here is the few screenshot for the preview. #
Avatar |
Conversation |
Demo |
Main Contributors #
Jemis Goti |
Thanks #
Thank you for using this package! Your support for the open-source community is greatly appreciated.