Skip to content

Commit

Permalink
feat(component): docs for participants are updated
Browse files Browse the repository at this point in the history
  • Loading branch information
thisisamank authored and palashgo committed Dec 12, 2022
1 parent 3e9decf commit c0ebc67
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 139 deletions.
68 changes: 31 additions & 37 deletions docs/flutter-core/participants/events.mdx
Expand Up @@ -11,81 +11,75 @@ Here are the supported methods:

### Page change

```kotlin
private val participantEventsListener = object : DyteParticipantEventsListener {
override fun onParticipantsUpdated(
participants: DyteRoomParticipants,
isNextPagePossible: Boolean,
isPreviousPagePossible: Boolean
) {
super.onParticipantsUpdated(participants, isNextPagePossible, isPreviousPagePossible)
// your code here to handle page updates.
}
```dart
@override
void onParticipantsUpdated({
required DyteRoomParticipants participants,
required bool isNextPagePossible,
required bool isPreviousPagePossible,
}) {
// your code here to handle page updates.
}
```

### Participant joined

Trigger an event when any participant joins the meeting.

```kotlin
private val participantEventsListener = object : DyteParticipantEventsListener {
override fun onParticipantJoin(participant: DyteMeetingParticipant) {
super.onParticipantJoin(participant)
```dart
@override
void onParticipantUpdated(DyteMeetingParticipant participant) {
// your code here to handle new participant
}
}
```

### Participant left

Trigger an event when any participant leaves the meeting.

```kotlin
private val participantEventsListener = object : DyteParticipantEventsListener {
override fun onParticipantLeave(participant: DyteMeetingParticipant) {
super.onParticipantLeave(participant)
```dart
@override
void onParticipantLeave(DyteMeetingParticipant participant) {
// your code here to handle participant left from meeting
}
}
```

### Video update

Trigger an event when any participant starts / stops video.

```kotlin
private val participantEventsListener = object : DyteParticipantEventsListener {
override fun videoUpdate(videoEnabled: Boolean, participant: DyteMeetingParticipant) {
super.videoUpdate(videoEnabled, participant)
```dart
@override
void videoUpdate({
required bool videoEnabled,
required DyteMeetingParticipant participant,
}) {
// your code here to handle participant video toggle update
}
}
```

### Audio update

Trigger an event when any participant starts / stops audio.

```kotlin
private val participantEventsListener = object : DyteParticipantEventsListener {
override fun audioUpdate(audioEnbled: Boolean, participant: DyteMeetingParticipant) {
super.audioUpdate(audioEnbled, participant)
```dart
@override
void audioUpdate({
required bool audioEnabled,
required DyteMeetingParticipant participant,
}) {
// your code here to handle participant audio toggle update
}
}
```

### Screen share update

Trigger an event when any participant starts / stops screen share.

```kotlin
private val participantEventsListener = object : DyteParticipantEventsListener {
override fun onScreenSharesUpdated() {
super.onScreenSharesUpdated()
// all screenshare participants can be fetched via
// meeting.participants.screenshares
```dart
@override
void onScreenSharesUpdated() {
// all screenshare participants can be fetched via
// meeting.participants.screenshares
}
}
```
93 changes: 22 additions & 71 deletions docs/flutter-core/participants/introduction.mdx
Expand Up @@ -10,9 +10,9 @@ tags: [mobile-core, participants, participant]
The data regarding all meeting participants is stored under `meeting.participants`. Use the methods and events to consume the participants data.
For example, to get all the participants who joined the meeting:

```kotlin
```dart
// get all joined participants
val joinedParticipants = meeting.participants.joined;
final joinedParticipants = meeting.participants.joined;
```

The `meeting.participants` object has the following properties.
Expand All @@ -33,84 +33,35 @@ You can subscribe to various events on the participants by implementing `DytePar

Triggered when the user starts / stops the video using `enableVideo` or `disableVideo`

```kotlin
meeting.self.addParticipantEventsListener(object : DyteParticipantEventsListener {
override fun videoUpdate(videoEnabled: Boolean, participant: DyteMeetingParticipant) {
super.videoUpdate(videoEnabled, participant)
if (videoEnabled) {
// video is enabled, and other participants in room can see local user
} else {
// video is disabled, and other participants in room can not see local user.
}
```dart
void onVideoUpdate(bool videoEnabled) {
if (videoEnabled) {
// video is enabled, and other participants in room can see local user
} else {
// video is disabled, and other participants in room can not see local user.
}
})
}
```

### Audio update

Triggered when the user starts / stops the audio using `enableAudio` or `disableAudio`

```kotlin
meeting.self.addSelfEventsListener(object : DyteSelfEventsListener {
override fun audioUpdate(audioEnabled: Boolean, participant: DyteMeetingParticipant) {
super.audioUpdate(audioEnabled, participant)
if (audioEnabled) {
// audio is enabled, and other participants in room can hear local user
} else {
// audio is disabled, and other participants in room can not hear local user.
}
}
})
```

## Set mode of pagination
```dart
The SDK allows you to view grid in two differant modes. First is `Grid` where SDK gives you list of `active` participants to show. Second is `Paginated` where user decides which page to view.

```kotlin
// for grid mode
meeting.participants.setMode(PageViewMode.GRID)
void audioUpdate({
required bool audioEnabled,
required DyteMeetingParticipant participant,
}) {
if (audioEnabled) {
// audio is enabled, and other participants in room can hear local user
} else {
// audio is disabled, and other participants in room can not hear local user.
}
}
// for paginated mode
meeting.participants.setMode(PageViewMode.PAGINATED)
```

## Move between pages in paginated mode

The `setPage(pageNumber: Int)` method allows you to switch between pages of participants present in the meeting.

```kotlin
// switch to 1st page
meeting.participants.setPage(1)
```

## Host control methods

The `meeting.participants` object has host control methods that allow you to disable the audio and video streams of other users in the meeting (given that the user preset has the right permissions).

```kotlin
// mute all participants
meeting.participants.disableAllAudio();

// mute a single participant
val participantToUpdate = meeting.participants.joined.first()
participantToUpdate.disableAudio()

// disable video for all participants
meeting.participants.disableAllVideo();

// disable video for a single participant
val participantToUpdate = meeting.participants.joined.first()
participantToUpdate.disableVideo()
```

To remove all participants from a meeting, you can call the `kickAll()` method.

```kotlin
// remove all participants from the meeting
meeting.participants.kickAll();

// remove a single participant
val participantToRemove = meeting.participants.joined.first()
participantToRemove.kick()
```
52 changes: 21 additions & 31 deletions docs/flutter-core/participants/participant-object.mdx
Expand Up @@ -16,41 +16,31 @@ The participant object has the following properties.
- `name`: The participant's name.
- `picture`: The participant's picture (if any).
- `clientSpecificId`: An arbitrary ID that can be set to identify the participant.
- `videoTrack`: The video track of the participant.
- `audioTrack`: The audio track of the participant.
- `screenShareTracks`: The video and audio (if any) track of the participant's screen share stream.
- `videoEnabled`: Set to true if the participant's camera is on.
- `audioEnabled`: Set to true if the participant is unmuted.

To be able to listen to participant updates you can use `DyteParticipantEventsListener`, pass object of this call using `meeting.addParticipantEventsListener(dyteParticipantEventsListener)`.

```kotlin
private val dyteParticipantEventsListener = object : DyteParticipantEventsListener {
override fun audioUpdate(audioEnabled: Boolean, participant: DyteMeetingParticipant) {
super.audioUpdate(audioEnabled, participant)
// audio toggle for participant
}

override fun videoUpdate(videoEnabled: Boolean, participant: DyteMeetingParticipant) {
super.videoUpdate(videoEnabled, participant)
// videp toggle for participant
}
```dart
@override
void onVideoUpdate(bool videoEnabled) {
if (videoEnabled) {
// video is enabled, and other participants in room can see local user
} else {
// video is disabled, and other participants in room can not see local user.
}
}
@override
void audioUpdate({
required bool audioEnabled,
required DyteMeetingParticipant participant,
}) {
if (audioEnabled) {
// audio is enabled, and other participants in room can hear local user
} else {
// audio is disabled, and other participants in room can not hear local user.
}
}
```

## Host controls methods

If you (the local user) have the relevant permissions in the meeting, you can disable a participant's video/audio streams, or even remove them from the meeting.

```kotlin
val participant = meeting.participants.joined.get(0);

// To disable a participant's video stream
participant.disableVideo();

// To disable a participant's audio stream
participant.disableAudio();

// To kick a participant from the meeting
participant.kick();
```

0 comments on commit c0ebc67

Please sign in to comment.