Skip to content

Commit

Permalink
Merge pull request #370 from dyte-io/flutter-core-docs-revamp
Browse files Browse the repository at this point in the history
Flutter core docs revamp
  • Loading branch information
saksham-gt authored Jul 2, 2024
2 parents c1c8058 + 3d4c5bd commit 34ca0d5
Show file tree
Hide file tree
Showing 23 changed files with 878 additions and 331 deletions.
38 changes: 38 additions & 0 deletions docs/flutter-core/introduction.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
title: Introduction
sidebar_position: 3
sidebar_class_name: module-seperation
---

import ProductSection from '/docs/partials/_product-section.mdx';

# Introduction

The Dyte Core SDK is designed to provide you with an easy way to incorporate live video, voice, livestream and chat capabilities into your Android apps. The Core SDK acts as a data-only layer. It provides simple APIs offering high-level primitives and abstracting away complex media and networking optimizations.

## Why Core SDK?

The Core SDK was developed with a user-friendly approach to eliminate the complexity of managing streams. Unlike traditional
SDKs that require knowledge of WebRTC functioning, Dyte's Core SDK provides a simple API that abstracts out the complexity,
making it easier for developers to use. For instance, enabling video with Dyte's Core SDK is as easy as calling
`dyteMobileClient.localUser.enableVideo()`.

## Utility Modules

The Core SDK includes various modules for in-call utilities like chat, polls, and recording that enable building a UI on top of
it. The following are the core SDK modules:

- **meeting.localUser**: This consists of properties and methods corresponding to the current (local) user, such as enabling or disabling their audio and video, getting a list of media devices or changing the device, or sharing your mobile screen.
- **meeting.participants**: Use this module to get useful information about the other participants that are present in the meeting. A host can use this module for access control. For example, the host can mute or kick a participant.
- **meeting.chat**: It provides the methods to integrate chat features such as sending/receiving text, images, and files.
- **meeting.polls**: Meetings can have polls. This module lets you perform actions related to polls, that is create and manage
a poll within a meeting.
- **meeting.recording**: When a meeting needs to be recorded, this module can be used. It lets you start or stop a recording,
and get the current status of an ongoing recording.
- **meeting.meta**: This object consists of all the metadata related to the current meeting, such as the title, the timestamp
of when it started, and more.
- **meeting.plugins**: Provides the list of available plugins and active plugins. Use this module to enable or disable plugins as needed.

<head>
<title>Flutter Core Introduction</title>
</head>
3 changes: 1 addition & 2 deletions docs/flutter-core/livestream.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ tags:
- Livestreaming is often used for events, such as concerts, conferences, and sports games, as well as for online classes, gaming, and social media platforms.
- Dyte uses LHLS to deliver low latency one way streams.
- The Interactive Livestream product delivers interactivity via chat, polls, reactions etc.
- Viewer can also be pulled in the livestream by the host using Stage Management APIs [ref: [here](/flutter-core/stage-management)].
- Viewer can also be pulled in the livestream by the host using Stage Management APIs [ref: [here](/flutter-core/stage-management/introduction)].

This section will guide you through the process of integrating the livestreaming feature into your product.

Expand Down Expand Up @@ -142,5 +142,4 @@ Here are a list of events the livestream listener emits:

<head>
<title>Flutter Core Livestreaming</title>

</head>
84 changes: 70 additions & 14 deletions docs/flutter-core/local-user/events.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -140,25 +140,70 @@ When the local user is removed from the meeting, the `onRemovedFromMeeting()` ca

```dart
@override
void onRemovedFromMeeting() {
// Display an alert to the user indicating that they are no longer in the meeting.
class LocalUserNotifier implements DyteSelfEventsListener {
...
@override
void onRemovedFromMeeting() {
// Display an alert to the user indicating that they are no longer in the meeting.
}
...
}
```

## Screenshare callbacks for local user

```dart
class LocalUserNotifier implements DyteSelfEventsListener {
...
@override
void onScreenShareStartFailed(String reason) {
// screenshare failed to start
}
@override
void onScreenShareStarted() {
// screenshare started presenting in the meeting
}
@override
void onScreenShareStopped() {
// screenshared stopped by the local user
}
...
}
```

## Change in audio/video source

Whenever user changes audio/video source using `setAudioDevice(DyteAudioDevice)` and `setVideoDevice(DyteVideoDevice)` respectively [ref: [here](/flutter-core/local-user/manage-media-devices)], `onAudioDevicesUpdated()` and `onVideoDevicesChanged()` are triggered respectively.

```dart
@override
void onAudioDevicesUpdated() {
// triggered on successful execution of `setAudioDevice(DyteAudioDevice)`
}
@override
void onVideoDeviceChanged(DyteVideoDevice videoDevice) {
// triggered on successful execution of `setVideoDevice(DyteVideoDevice)`
class LocalUserNotifier implements DyteSelfEventsListener {
...
@override
void onAudioDevicesUpdated() {
// triggered on successful execution of `setAudioDevice(DyteAudioDevice)`
}
@override
void onVideoDeviceChanged(DyteVideoDevice videoDevice) {
// triggered on successful execution of `setVideoDevice(DyteVideoDevice)`
}
...
}
```
Expand All @@ -168,13 +213,24 @@ void onVideoDeviceChanged(DyteVideoDevice videoDevice) {
Manage messages within the room using `onRoomMessage(String message)` callback.

```dart
@override
void onRoomMessage(String type, Map<String, dynamic> payload) {
// triggered when a message is sent within the room.
class LocalUserNotifier implements DyteSelfEventsListener {
...
@override
void onRoomMessage(String type, Map<String, dynamic> payload) {
// triggered when a message is sent within the room.
}
...
}
```

<head>
<title>Flutter Core Events</title>
<meta name="description" content="Explore events related to local user interactions in Flutter. Follow our documentation for effective handling of local user events in your app."/>
<meta
name="description"
content="Explore events related to local user interactions in Flutter. Follow our documentation for effective handling of local user events in your app."
/>
</head>
26 changes: 20 additions & 6 deletions docs/flutter-core/local-user/introduction.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ tags:

# Introduction - Local User

`DyteSelfUser` object contain all the methods and properties about the self user including their
media controls for the current room.
The local user in the `dyteMobileClient` object has a set of methods and properties related to media controls. These can be accessed using the identifier localUser.

## Properties

Expand All @@ -23,16 +22,13 @@ Here is a list of properties that local user provides:
- `userId`: The `userId` of the participant.
- `name`: Contains Name of the local user.
- `picture`: Link to the url of the participant
- `isHost`: Boolean value indicating whether this user is host of current
meeting or not.
- `clientSpecificId`: Identifier provided by the developer while adding the
participant.
- `flags`: Type `ParticipantFlags` and it contains two boolean values
- `recorder`: if the participant is recorder
- `hidden`: if the participant is hidden
- `audioEnabled`: Boolean value indicating if the audio currently enabled.
- `videoEnabled`: Boolean value indicating if the video currently enabled.
- `stageStatus` : Stage status of the local participant.

Local user properties can be fetched via `localUser` getter on the `dyteClient`.

Expand Down Expand Up @@ -114,6 +110,21 @@ dyteClient.localUser.switchCamera();

## Enable / Disable Screen share

:::tip Note

### Android

To use screenshare on Android devices running Android API 14 and above, you will need to declare the following permission in your app's AndroidManifest.xml.

`<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION" />`

Adding above permission will require you to do extra steps on Google Play Console while submitting the app. For more information please refer [this](https://support.google.com/googleplay/android-developer/answer/13392821?hl=en#declare).

### iOS

Refer to screenshare setup for iOS [here](./screen-share-iOS-guide.mdx)
:::

```dart
// Enable Screenshare
dyteClient.localUser.enableScreenshare();
Expand All @@ -124,5 +135,8 @@ dyteClient.localUser.disableScreenshare();

<head>
<title>Flutter Core Introduction</title>
<meta name="description" content="Learn about the local user concept in Flutter with Dyte's documentation. Follow our guide for a smooth introduction and integration."/>
<meta
name="description"
content="Learn about the local user concept in Flutter with Dyte's documentation. Follow our guide for a smooth introduction and integration."
/>
</head>
53 changes: 53 additions & 0 deletions docs/flutter-core/local-user/manage-permissions.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
title: Media Permissions
description: >-
Learn how to manage permissions in your Flutter application for a secure and
controlled user experience with Dyte Docs.
sidebar_position: 5
tags:
- flutter-core
- local-user
- self
- self events
---

# Media Permissions

To get media permissions (audio/video) for localUser we can do as follows

```dart
final isCameraPermissionGranted
= dyteMobileClient.localUser.permissions.isCameraPermissionGranted;
final isMicrophonePermissionGranted
= dyteMobileClient.localUser.permissions.isMicrophonePermissionGranted;
```

Similarly to listen to callbacks regarding media permissions once user joins
the meeting

```dart
class LocalUserNotifier implements DyteSelfEventsListener {
...
@override
void onMeetingRoomJoinedWithoutCameraPermission() {
// when meeting room is joined without camera permission
}
override
void onMeetingRoomJoinedWithoutMicPermission() {
// when meeting room is joined without microphone permission
}
...
}
```

<head>
<title>Flutter Core Media Permissions</title>
<meta
name="description"
content="Learn how to manage permissions in your Flutter application for a secure and controlled user experience with Dyte Docs."
/>
</head>
4 changes: 2 additions & 2 deletions docs/flutter-core/participants/_category_.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"position": 5,
"label": "Participants",
"position": 7,
"label": "Remote Participants",
"collapsible": true
}
2 changes: 1 addition & 1 deletion docs/flutter-core/participants/participant-object.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Participant object
title: Participant Object
description: >-
Understand the participant object and its integration in Flutter. Follow
Dyte's documentation for effective implementation in your app.
Expand Down
39 changes: 39 additions & 0 deletions docs/flutter-core/participants/remote-participants.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
title: Participant Types
description: 'Events, methods and data pertaining to meeting participants.'
sidebar_position: 1
slug: /participants/
tags:
- flutter-core
- participants
---

# Participant Types

The data regarding all meeting participants is stored under `meeting.participants`. These **does not** include the local user. Use the methods and events to consume the participants data. For example, to get all the participants who joined the meeting:

```kotlin
// get all joined participants
final List<DyteJoinedMeetingParticipant> joined = dyteMobileClient.participants.active;

// get active participants
final List<DyteJoinedMeetingParticipant> active = dyteMobileClient.participants.active;
```

The `dyteMobileClient.participants` object has the following **lists** of participants

- **joined**: A list that contains all the participants who are currently in the meeting
except the local user
- **waitlisted**: A list that contains all the participants waiting to join the
meeting.
- **active**: A list that contains all the participants, **including** the local user whose media is subscribed to i.e participants who are supposed to be on the screen at the moment, including the local user.
- **pinned**: A list that contains all the pinned participants of the meeting.
- **screenShares**: A list that contains all the participants who are sharing their screen.

Therefore if you were to make a video / audio grid of participants, you'd use the `active` list, but to display the list of all participants in the meeting you'd use the `joined` list.

Each participant in each of the `joined`, `active`, `pinned` and `screenShares` list are of type `DyteJoinedMeetingParticipant`, `waitlisted` list is of type `DyteWaitlistedParticipant`.

<head>
<title>Flutter Core Participants</title>
</head>
Loading

0 comments on commit 34ca0d5

Please sign in to comment.