Skip to content

Commit

Permalink
Merge branch 'main' into feat/reconnect-v2
Browse files Browse the repository at this point in the history
  • Loading branch information
Brazol committed Sep 20, 2024
2 parents ba7ccee + aee41e9 commit a5717d5
Show file tree
Hide file tree
Showing 204 changed files with 1,409 additions and 4,956 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/legacy_version_analyze.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: legacy_version_analyze
env:
# Note: The versions below should be manually updated after a new stable
# version comes out.
flutter_version: "3.19.5"
flutter_version: "3.22.0"

on:
push:
Expand Down Expand Up @@ -62,8 +62,8 @@ jobs:
- name: "Stream Video Flutter Analyze"
run: cd packages/stream_video_flutter/lib && dart analyze --no-fatal-warnings .

- name: "Stream Video Flutter Background Analyze"
run: cd packages/stream_video_flutter_background/lib && dart analyze --no-fatal-warnings .

- name: "Stream Video Push Notification Analyze"
run: cd packages/stream_video_push_notification/lib && dart analyze --no-fatal-warnings .
run: cd packages/stream_video_push_notification/lib && dart analyze --no-fatal-warnings .

- name: "Stream Video Flutter Screen Sharing Analyze"
run: cd packages/stream_video_screen_sharing/lib && dart analyze --no-fatal-warnings .
2 changes: 1 addition & 1 deletion .github/workflows/stream_video_flutter_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: stream_video_flutter_workflow

env:
FLUTTER_CHANNEL: stable
FLUTTER_VERSION: 3.22.3
FLUTTER_VERSION: 3.24.3
ENV_PROPERTIES: ${{ secrets.ENV_PROPERTIES }}

on:
Expand Down
6 changes: 4 additions & 2 deletions .styles/config/vocabularies/Base/accept.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ API
timeframe
APNs
Telehealth
Flutter
telemedicine
[Ff]lutter
Podfile
protobuf
protos
Expand Down Expand Up @@ -37,4 +38,5 @@ screensharing
[Ss]creen[Ss]hare
Livestreaming
livestreaming
callee
callee
audio_room
58 changes: 19 additions & 39 deletions docusaurus/docs/Flutter/01-setup/01-introduction.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,52 +4,32 @@ title: Introduction
description: Introduction to Stream's Video SDK
---

Welcome to the Stream [Flutter SDK](https://getstream.io/video/sdk/flutter/) - a comprehensive toolkit designed to help developers quickly implement real-time video calling, audio rooms, and live streaming directly into their Flutter app, all in Dart.

Our Flutter SDK comes with out-of-the-box widgets such as calling indicators, participant screens, and more. These components make it simple and intuitive to add rich experiences with just a few lines of code. Additionally, advanced features such as CallKit integration, push notifications, and background track handling are supported, all with minimal overhead.
Welcome to the [Stream Video Flutter SDK](https://getstream.io/video/sdk/flutter/) - a comprehensive toolkit designed to help you swiftly implement features such as video calling, audio calling, audio rooms, and livestreaming within your app.

If you are new to the Stream Video SDK, we recommend starting with the following three tutorials:
Our goal is to ensure an optimal developer experience that enables your application to go live within days.

Our Flutter SDK is furnished with user-friendly UI components and versatile state objects, making your development process seamless.
Moreover, all calls are routed through Stream's global edge network, thereby ensuring lower latency and higher reliability due to proximity to end users.

If you're new to Stream Video SDK, we recommend starting with the following three tutorials:
- [Video & Audio Calling Tutorial](https://getstream.io/video/sdk/flutter/tutorial/video-calling/)
- [Audio Room Tutorial](https://getstream.io/video/sdk/flutter/tutorial/audio-room/)
- [Livestream Tutorial](https://getstream.io/video/sdk/flutter/tutorial/livestreaming/)

After the tutorials, the documentation explains how to use the

After the tutorials the documentation explains how to use the SDK. Our Flutter SDK is divided into three parts to help you quickly and effectively build video and voice applications with Stream:

1. `stream_video_flutter`
2. `stream_video`
3. `stream_video_push_notification`

### Stream Video Flutter

Stream Video Flutter includes all of our modular, pre-made widgets, which developers can use to quickly build with Stream. In addition to the UI components, this package also includes all of our Flutter-specific handling and logic, such as background handling, push notification support, and more.

These screens and widgets include:

- Call Controls
- Call Screen
- Lobby Screen
- Participant Rendering and Layout
- etc.

### Stream Video

Stream Video is our base package, which acts as a low-level wrapper around the Stream Video API. It allows you to authenticate users, listen to events, and perform low-level operations such as creating a call, joining, inviting, sorting, and permission handling.

The entry point for interacting directly with the Stream API is the `StreamVideo` class. This class is a singleton that can be accessed throughout your application via the static `instance` method.

For example:

```dart
StreamVideo.instance.makeCall(callType: StreamCallType.defaultType(), id: "YOUR-CALL-ID");
```

We will look at these concepts in more detail in the following sections.

While developers are free to use `stream_video` in their applications directly, we recommend using our `stream_video_flutter` package instead since it contains many Flutter-specific configurations and behavior handling not included in the base package.
* Core concepts such as initiating a call, switching the camera view, and more
* Effective utilization of our UI components
* Insights on building your own UI with our UI Cookbook

### Push Notifications
It also explains advanced features such as:

Push notifications are implemented and handled by `stream_video_push_notification`. This package configures the integration between Flutter and the underlying platform (iOS and Android), allowing for seamless integration and handling of push and call notifications to the device. Our push service is backed by Firebase Cloud Messaging.
* Picture-in-Picture support
* Ringing
* Recording
* Broadcasting
* Requesting & Granting permissions
* Audio & Video Filters

Please refer to our push notifications section for a more detailed guide.
If you feel like anything is missing or could be improved, please don't hesitate to [contact us]([email protected]). We're happy to help.
64 changes: 44 additions & 20 deletions docusaurus/docs/Flutter/01-setup/02-installation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,33 @@ slug: /installation
title: Installation
---

### Creating a Project
The Flutter SDK for Stream Video is distributed through [pub.dev](https://pub.dev).
The SDK contains four different packages: [stream_video_flutter](https://pub.dev/packages/stream_video_flutter), [stream_video](https://pub.dev/packages/stream_video), [stream_video_push_notification](https://pub.dev/packages/stream_video_push_notification) and [stream_video_screen_sharing](https://pub.dev/packages/stream_video_screen_sharing).
Releases and changes are published on the [GitHub releases page](https://github.com/GetStream/stream-video-flutter/releases).

To get started with the `StreamVideo` Flutter SDK, open your terminal or IDE and create a new project:
### Adding the SDK to your project

```shell
flutter create video_demo
To add the Flutter SDK, you can add the latest dependencies for the SDK to your `pubspec.yaml` file:

```yaml
dependencies:

stream_video: ^latest
stream_video_flutter: ^latest
stream_video_push_notification: ^latest
stream_video_screen_sharing: ^latest
```
Next, in your project directory (`video_demo`), install the Stream Video SDK using the following:
Additionally, you can also run the `flutter pub add` command in the terminal to do this:

```shell
flutter pub add stream_video_flutter
flutter pub add stream_video
flutter pub add stream_video_push_notification
flutter pub add stream_video_screen_sharing
```

This will automatically install the latest version of the Stream SDK from pub to the dependencies section of your `pubspec.yaml`.
This command will automatically install the latest versions of the Stream SDK packages from pub.dev to the dependencies section of your `pubspec.yaml`.

### Permissions

Expand All @@ -34,11 +46,28 @@ The following permissions must be granted for both Android and iOS:

![Xcode Permission configuration](../assets/installation/ios_permission.png)

For iOS, you need to add the following keys and values to your `Info.plist` file at a minimum:

`Privacy - Camera Usage Description` - "<Your_app_name> requires camera access to capture and transmit video"

`Privacy - Microphone Usage Description` - "<Your_app_name> requires microphone access to capture and transmit audio"
For iOS, we recommend you add the following keys and values to your `Info.plist` file at a minimum:

```plist
<key>NSCameraUsageDescription</key>
<string>$(PRODUCT_NAME) needs access to your camera for video calls.</string>
<key>NSMicrophoneUsageDescription</key>
<string>$(PRODUCT_NAME) needs access to your microphone for voice and video calls.</string>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>BGTaskSchedulerPermittedIdentifiers</key>
<array>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
</array>
<key>UIBackgroundModes</key>
<array>
<string>audio</string>
<string>fetch</string>
<string>processing</string>
<string>remote-notification</string>
<string>voip</string>
</array>
```

#### Android

Expand All @@ -59,15 +88,10 @@ With Android specifically, you will also need to add additional permission if yo
```xml
<uses-permission android:name="android.permission.BLUETOOTH" android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT"/>
```

## Platform Version

Stream's Flutter Video SDK is supported on Android and iOS devices running the following versions and higher:

- Android: SDK version 21 and above
- iOS: iOS 13 and above
### VoIP Calling

:::note
For iOS, when setting the minimum version, please also be sure to update the `deployment_target` in your project's Podfile.
:::
We also ship the [stream_video_push_notification](https://pub.dev/packages/stream_video_push_notification) package to allow you to add integrations with native calling interfaces such as [CallKit](https://developer.apple.com/documentation/callkit/).
Please check out our [ringing guide](https://getstream.io/video/docs/flutter/advanced/ringing_and_callkit/) for additional setup needed for integration.
25 changes: 16 additions & 9 deletions docusaurus/docs/Flutter/01-setup/03-quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,18 @@ slug: /quickstart
title: Quickstart
---

The Flutter Video for Stream Video is a highly customizable SDK that facilitates adding calling (audio and video) support to your apps.

In this guide, we will cover the basics of making your first call using Stream Video. If you haven't already, we recommend starting with the **introduction** and **installation** steps first, as this guide will build on the material covered in those sections.
The SDK consists of four parts:

* Low-level client ([stream_video](https://pub.dev/packages/stream_video)): Responsible for establishing calls, built on top of WebRTC.
* UI SDK ([stream_video_flutter](https://pub.dev/packages/stream_video_flutter)): Flutter widgets for different types of call flows.
* VoIP SDK ([stream_video_push_notification](https://pub.dev/packages/stream_video_push_notification)): Adds native calling interface support for Android and iOS (CallKit).
* Screen sharing SDK ([stream_video_screen_sharing](https://pub.dev/packages/stream_video_screen_sharing)): Includes a native Swift implementation of `BroadcastSampleHandler`, essential for the `broadcast` screen sharing mode on iOS.

In this guide, we will build a video calling app that shows how you can integrate the SDK in few simple steps.

If you haven't already, we recommend starting with the [introduction](https://getstream.io/video/docs/flutter/) and [installation](https://getstream.io/video/docs/flutter/installation/) steps first, as this guide will build on the material covered in those sections.

### Client Setup

Expand All @@ -23,21 +33,18 @@ Future<void> main() async {
// Initialize Stream video and set the API key along with the user for our app.
final client = StreamVideo(
'YOUR-API-KEY',
user: User.regular(userId: 'testing', name: 'Test User'),
userToken: 'YOUR-USER-TOKEN',
options: const StreamVideoOptions(
logPriority: Priority.info,
),
'REPLACE_WITH_API_KEY',
user: User.regular(userId: 'REPLACE_WITH_USER_ID', name: 'Test User'),
userToken: 'REPLACE_WITH_TOKEN',
);
// Set up our call object and pass it the call type and ID. The most common call type is `default`, which enables full audio and video transmission
final call = client.makeCall(callType: StreamCallType.defaultType(), id: '345');
final call = client.makeCall(callType: StreamCallType.defaultType(), id: 'REPLACE_WITH_CALL_ID');
// Connect to the call we created
await call.join();
runApp(
StreamVideoGettingStarted(
DemoAppHome(
call: call,
),
);
Expand Down
46 changes: 35 additions & 11 deletions docusaurus/docs/Flutter/03-core-concepts/01-authentication.mdx
Original file line number Diff line number Diff line change
@@ -1,13 +1,31 @@
---
slug: /client-and-authentication
title: Client and Authentication
sidebar_position: 1
---

### Client Overview
import { TokenSnippet } from '../../../shared/_tokenSnippet.jsx';

`StreamVideo` is the main class used for creating class, performing authentication and listening to core events dispatched by Stream’s servers.

Before users are able to join or create a call, the client must first be configured with an `apiKey` obtained from the Stream Dashboard for the given project.
Before joining a call, it is necessary to set up the video client. Here's a basic example:

```dart
final client = StreamVideo(
'REPLACE_WITH_API_KEY',
user: User.regular(
userId: 'REPLACE_WITH_USER_ID',
name: 'John Doe',
),
userToken: 'REPLACE_WITH_TOKEN',
);
```

* The API Key can be found in your Stream dashboard.
* The User can be either authenticated, anonymous or guest.
* Note: You can store custom data on the user object, if required.

`StreamVideo` is the main class used for creating class, performing authentication and listening to core events dispatched by Stream’s servers.

The initialization constructor for `StreamVideo` also exposes many customization options which can be overridden based on the project needs such as the logging level, SDP policy, retry policy, etc.

Expand Down Expand Up @@ -37,10 +55,11 @@ factory StreamVideo(
});
```

The SDK tries to connect automatically by default. You can set `autoConnect` to false in `StreamVideoOptions`
to change this behaviour.
:::note
The SDK tries to connect to Stream's backend automatically by default. You can set `autoConnect` to false in `StreamVideoOptions` to change this behaviour.
:::

To connect later, you can use the `connect()` method:
If you choose to connect later, you can use the `connect()` method to connect to Stream Video:

```dart
StreamVideo.instance.connect();
Expand All @@ -60,18 +79,22 @@ or use the `includeUserDetails` parameter when using the `connect()` method:

All tokens must be generated via a backend SDK and cannot be created from a frontend client. This step is typically included whenever a new user is registered on your backend.

There are a few ways in which users can connect using our SDK. We support both long lived tokens and dynamic tokens via two parameters accessible on the `StreamVideo` class:
Here's a valid user and token to help you get started on the client side, before integrating with your backend API.

<TokenSnippet sampleApp='meeting' displayStyle='credentials'/>

There are a few ways in which users can connect using our SDK.
We support both long lived tokens and dynamic tokens via two parameters accessible on the `StreamVideo` class:

- `StreamVideo(apiKey, user: User, userToken: String)`
- `StreamVideo(apiKey, user: User, tokenLoader: TokenLoader)`

For situations where your backend does not require tokens to be refreshed, the first variant can be used by simply passing in a `User` object and the `userToken` as a `String`.

*Dynamic tokens*
For situations where your backend does not require tokens to be refreshed, the first variant of the two above can be used by simply passing in a `User` object and the `userToken` as a `String`.

Using the second variant, a Token Loader can be used to dynamically load a token from a server. On expiration, the SDK automatically calls the Token Loader to obtain a new token.

As long as your handler returns a `String` it will satisfy the contract of `TokenLoader`
As long as your handler returns a `String` it will satisfy the contract of `TokenLoader`.
Here is an example of how you could write the token loader

```dart
Future<String> _tokenLoader(String userId) async {
Expand All @@ -95,7 +118,7 @@ StreamVideo(
);
```

### Anonymous users
### Anonymous / Guest users

For use-cases like live streaming or guest meeting, you may want to allow users to join a call without creating an account.

Expand All @@ -113,6 +136,7 @@ final result = await client.connect();
final userToken = result.getDataOrNull();
final userInfo = client.currentUser;
```

:::note
`userInfo.id` will be slightly different from what you passed in. This is because the SDK will generate a unique ID for the user.
Please use the generated ID across your app.
Expand Down
Loading

0 comments on commit a5717d5

Please sign in to comment.