Speak Pro Meet Flutter SDK

A Flutter plugin that serves as a Speak Pro Meet Flutter SDK which provides the same user experience as the Speak Pro Meet app, in the form of a Flutter plugin so that you can embed and customize Speak Pro Meet in your own Flutter app.

Supported platforms

Platform Supported Notes
Android Minimum API level is 24
iOS Minimum supported version is 15.1
Web

Installation

Add dependency

Add the dependency from command-line

$ flutter pub add speakpro_meet_flutter_sdk

The command above will add this to the pubspec.yaml file in your project (you can do this manually):

dependencies:
    speakpro_meet_flutter_sdk: ^1.0.0

Install

Install the packages from the terminal:

$ flutter pub get

Import files

Import the following files into your dart code:

import 'package:speakpro_meet_flutter_sdk/speakpro_meet_flutter_sdk.dart';

Usage

Join meeting

Firstly, create a SpeakProMeet object, then call the method join from it with a SpeakProMeetConferenceOptions object

var speakProMeet = SpeakProMeet();
var options = SpeakProMeetConferenceOptions(room: 'SpeakProIsAwesome');
speakProMeet.join(options);

Configuration

iOS

Make sure in Podfile from ios directory you set the ios version 15.1 or higher

platform :ios, '15.1'

The plugin requests camera and microphone access, make sure to include the required entries for NSCameraUsageDescription and NSMicrophoneUsageDescription in your Info.plist file from the ios/Runner directory.

<key>NSCameraUsageDescription</key>
<string>The app needs access to your camera for meetings.</string>
<key>NSMicrophoneUsageDescription</key>
<string>The app needs access to your microphone for meetings.</string>

Android

Go to android/app/build.gradle and make sure that the minSdkVersion is set to at least 24

android {
    ...
    defaultConfig {
        ...
        minSdkVersion 24
    }
}

The application:label field from the Speak Pro Meet Android SDK will conflict with your application's one. Go to android/app/src/main/AndroidManifest.xml and add the tools library and tools:replace="android:label" to the application tag.

<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools">
    <application
        tools:replace="android:label"
        android:label="sample_app"
        android:name="${applicationName}"
        android:icon="@mipmap/ic_launcher">
        ...
    </application>
</manifest>

Using the API

SpeakProMeet

The SpeakProMeet class is the entry point for the SDK. It is used to launch the meeting screen, to send and receive all the events.

  1. SpeakProMeet()
    The constructor for the class.

  2. join(SpeakProMeetConferenceOptions options, SpeakProMeetEventListener? listener)
    Joins a meeting with the given options and optionally a listener is given

    • options : meeting options
    • listener : event listener for events triggered by the native SDKs
  3. hangUp()
    The localParticipant leaves the current meeting.

  4. setAudioMuted(bool muted)
    Sets the state of the localParticipant audio muted according to the muted parameter.

  5. setVideoMuted(bool muted)
    Sets the state of the localParticipant video muted according to the muted parameter.

  6. sendEndpointTextMessage({String? to, required String message})
    Sends a message via the data channel to one particular participant or to all of them. If the to param is empty, the message will be sent to all the participants in the conference.

  7. toggleScreenShare(bool enabled)
    Sets the state of the localParticipant screen sharing according to the enabled parameter.

  8. openChat(String? to)
    Opens the chat dialog. If to contains a valid participantId, the private chat with that particular participant will be opened.

  9. sendChatMessage({String? to, required String message})
    Sends a chat message to one particular participant or to all of them.

  10. closeChat()
    Closes the chat dialog.

  11. retrieveParticipantsInfo()
    Sends an event that will trigger the participantsInfoRetrieved event which will contain participants information.

SpeakProMeetConferenceOptions

This object encapsulates all the options that can be tweaked when joining a conference.

Example:

var options = SpeakProMeetConferenceOptions(
      serverURL: "https://meet.speakpro.com",
      room: "SpeakProIsAwesomeWithFlutter",
      configOverrides: {
        "startWithAudioMuted": false,
        "startWithVideoMuted": false,
        "subject" : "Speak Pro with Flutter",
      },
      featureFlags: {
        "unsaferoomwarning.enabled": false
      },
      userInfo: SpeakProMeetUserInfo(
          displayName: "Flutter user",
          email: "user@example.com"
      ),
    );

SpeakProMeetUserInfo

The constructor for the SpeakProMeetUserInfo. The avatar should be a URL.

SpeakProMeetUserInfo(
  displayName: "John Doe",
  email: "john@example.com",
  avatar: "https://example.com/avatar.jpg"
)

SpeakProMeetEventListener

This class intends to be used as a listener for events that come from the native SDKs.

Example of listener:

var listener = SpeakProMeetEventListener(
      conferenceJoined: (url) {
        debugPrint("conferenceJoined: url: $url");
      },

      participantJoined: (email, name, role, participantId) {
        debugPrint(
          "participantJoined: email: $email, name: $name, role: $role, "
              "participantId: $participantId",
        );
        participants.add(participantId!);
      },

      chatMessageReceived: (senderId, message, isPrivate) {
        debugPrint(
          "chatMessageReceived: senderId: $senderId, message: $message, "
              "isPrivate: $isPrivate",
        );
      },

      readyToClose: () {
        debugPrint("readyToClose");
      },
    );

Example

Check out the example directory for a complete example of how to use the Speak Pro Meet Flutter SDK.

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Support

For support, email support@speakpro.com or join our Slack channel.