Skip to content

Commit 22d918d

Browse files
authored
docs(android-core): chat and stage v2 changes (MOB-1905, MOB-1908) (#406)
* chore(android-core): update chat docs with v2 changes * chore(android-core): update stage docs with v2 changes * chore: docs review changes
1 parent e425ab3 commit 22d918d

File tree

6 files changed

+117
-99
lines changed

6 files changed

+117
-99
lines changed

docs/android-core/chat/introduction.mdx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Introducing chat
2+
title: Introduction
33
description: >-
44
Learn the basics of integrating Dyte's chat functionality into your Android
55
application – a step towards immersive real-time communication.
@@ -29,7 +29,8 @@ class DyteTextMessage(
2929
pluginId: String?,
3030
val message: String,
3131
time: String,
32-
channelId: String? = null,
32+
createdAtMillis: Long,
33+
targetUserIds: List<String>?,
3334
)
3435
```
3536

@@ -43,7 +44,8 @@ class DyteImageMessage(
4344
pluginId: String?,
4445
val link: String,
4546
time: String,
46-
channelId: String? = null,
47+
createdAtMillis: Long,
48+
targetUserIds: List<String>?,
4749
)
4850
```
4951

@@ -57,9 +59,10 @@ class DyteFileMessage(
5759
pluginId: String?,
5860
val name: String,
5961
time: String,
62+
createdAtMillis: Long,
6063
val link: String,
6164
val size: Long,
62-
channelId: String? = null,
65+
targetUserIds: List<String>?,
6366
)
6467
```
6568

docs/android-core/chat/receiving-chat-messages.mdx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,25 @@ subscribe to this events by calling
2020
meeting.addChatEventsListener(object :
2121
DyteChatEventsListener {
2222
override fun onChatUpdates(messages: List<DyteChatMessage>) {
23-
// to load chat messages
23+
// to load chat messages
2424
}
2525

2626
override fun onNewChatMessage(message: DyteChatMessage) {
2727
// when a new chat message is shared in the meeting
2828
}
29+
30+
override fun onMessageRateLimitReset() {
31+
// when the rate limit for sending messages of self is reset
32+
}
2933
})
3034
```
3135

3236
The `onChatUpdates()` method will be called whenever there is a change in the chat messages. The `messages` parameter is a list of `DyteChatMessage` objects that have been sent in the chat.
3337

3438
The `onNewChatMessage()` method will be called whenever a new chat message is shared in the meeting. The `message` parameter is a `DyteChatMessage` object that has been sent in the chat.
3539

40+
The `onMessageRateLimitReset()` method will be called when the rate limit for sending messages of self is reset and you can send messages again. The default rate limit is 180 messages within 60 seconds.
41+
3642
<head>
3743
<title>Android Core Receiving chat</title>
3844
</head>

docs/android-core/chat/sending-a-chat-message.mdx

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,51 @@ You can send an image with the help of `meeting.chat.sendImageMessage()` and
2828
sends it to the participants in the meeting.
2929

3030
```kotlin
31-
val filePath = "file_path_of_image"
32-
val fileName = "file_name"
33-
meeting.chat.sendImageMessage(filePath, fileName)
31+
meeting.chat.sendImageMessage(imageUri) { err ->
32+
// Handle error if any
33+
}
3434
```
3535

3636
## Send a file
3737

3838
Sending a file is quite similar to sending an image. The only difference is that when you send an image, a preview will be shown in the meeting chat, which is not the case for sending files. That being said, an image can be sent as a file too using `meeting.chat.sendFileMessage()`.
3939

4040
```kotlin
41-
val filePath = "file_path_of_image"
42-
val fileName = "file_name"
43-
meeting.chat.sendFileMessage(filePath, fileName)
41+
meeting.chat.sendFileMessage(fileUri) { err ->
42+
// Handle error if any
43+
}
44+
```
45+
46+
## Chat Errors
47+
48+
The `sendTextMessage` method returns a `ChatTextError` if the operation fails, `null` if successful. The error can be the following:
49+
50+
- `PermissionDenied`: The user does not have permission to send a message.
51+
- `MessageIsBlank`: The message is empty.
52+
- `CharacterLimitExceeded`: The message exceeds the character limit. Default limit is 2000 characters.
53+
- `RateLimitBreached`: The user has sent too many messages in a short period of time.
54+
55+
Both `sendImageMessage` and `sendFileMessage` methods accept a callback function that will be called with a `ChatFileError` if the operation is not successful, otherwise with `null` if successful.
56+
57+
Possible `ChatFileError`s are:
58+
59+
- `FileFormatNotAllowed`: The file format is not allowed.
60+
- `PermissionDenied`: The user does not have permission to send a file.
61+
- `RateLimitBreached`: The user has breached the rate limit for sending messages.
62+
- `ReadFailed`: The file could not be read.
63+
- `UploadFailed`: The file could not be uploaded.
64+
65+
A `when` block can be used to handle these errors inside the callback, as shown below:
66+
67+
```kotlin
68+
when (err) {
69+
is ChatFileError.FileFormatNotAllowed -> {}
70+
is ChatFileError.PermissionDenied -> {}
71+
is ChatFileError.RateLimitBreached -> {}
72+
is ChatFileError.ReadFailed -> {}
73+
is ChatFileError.UploadFailed -> {}
74+
else -> {}
75+
}
4476
```
4577

4678
<head>

docs/android-core/stage-management/1-introduction.mdx

Lines changed: 36 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ tags:
99

1010
_Below documentation is relevant for Interactive Livestream(LHLS) and Webinar(WebRTC) use cases._
1111

12-
Instead of a traditional publish-subscribe model, where a user can publish their media and others can choose to subscribe, Dyte
13-
comes with an optional managed configuration. In this managed configuration, a less privileged user can be configured with a
14-
default behavior to not publish media. The user can then request permission to publish their media, which a privileged user can
12+
Instead of a traditional publish-subscribe model, where a user can publish their media and others can choose to subscribe, Dyte
13+
comes with an optional managed configuration. In this managed configuration, a less privileged user can be configured with a
14+
default behavior to not publish media. The user can then request permission to publish their media, which a privileged user can
1515
choose to grant or deny.
1616

1717
### Accessing the Stage APIs
@@ -21,27 +21,25 @@ permissions, and kicking participants from the stage. These APIs are accessible
2121

2222
### Stage Status
2323

24-
In meetings where stage management is enabled, a user's stage status can change within the values represented by the `DyteStageStatus`
24+
In meetings where stage management is enabled, a user's stage status can change within the values represented by the `StageStatus`
2525
enum. These status values include:
2626

2727
- `ON_STAGE`: Indicates that the user is currently on the stage and is allowed to publish media.
2828
- `OFF_STAGE`: Indicates that the user is a viewer and is not on the stage. They can see and listen to those on stage.
29-
- `REQUESTED_TO_JOIN_STAGE`: Indicates that the user has a pending request to join the stage. This status is assigned to the user
29+
- `REQUESTED_TO_JOIN_STAGE`: Indicates that the user has a pending request to join the stage. This status is assigned to the user
3030
until the host accepts or rejects their request.
3131
- `ACCEPTED_TO_JOIN_STAGE`: Indicates that the host has accepted the user's request to join the stage.
32-
- `REJECTED_TO_JOIN_STAGE`: Indicates that the host has rejected the user's request to join the stage. The user can request again
33-
to join from this status.
3432

35-
The `meeting.stage.status` property provides the current stage status of the local user.
33+
The `meeting.stage.stageStatus` property provides the current stage status of the local user.
3634

3735
### Viewers
3836

39-
You can retrieve a list of off-stage participants (viewers) in a stage-enabled meeting by accessing the `meeting.stage.viewers`
40-
property. This property provides a list of `DyteJoinedMeetingParticipant` objects whose stage status is not `ON_STAGE`.
37+
You can retrieve a list of off-stage participants (viewers) in a stage-enabled meeting by accessing the `meeting.stage.viewers`
38+
property. This property provides a list of `DyteRemoteParticipant` objects whose stage status is not `ON_STAGE`.
4139

4240
### Joining the Stage
4341

44-
To interact with peers and publish media, users can join the stage. This action is only possible if the user's preset allows them
42+
To interact with peers and publish media, users can join the stage. This action is only possible if the user's preset allows them
4543
to publish media or if their request to join the stage has been accepted by a host (i.e., their stage status is `ACCEPTED_TO_JOIN_STAGE`).
4644

4745
```kotlin
@@ -50,7 +48,7 @@ meeting.stage.join()
5048

5149
### Leaving the Stage
5250

53-
When users want to stop interacting with peers, they can leave the stage. This action stops their media from being published,
51+
When users want to stop interacting with peers, they can leave the stage. This action stops their media from being published,
5452
and their audio and video are no longer received by others in the room.
5553

5654
```kotlin
@@ -59,64 +57,55 @@ meeting.stage.leave()
5957

6058
### List of Stage Events
6159

62-
The `DyteStageEventListener` interface provides callback methods for various stage events. Implement these callbacks to handle
60+
The `DyteStageEventListener` interface provides callback methods for various stage events. Implement these callbacks to handle
6361
stage-related events in your application:
6462

6563
```kotlin
66-
meeting.addStageEventsListener(object : DyteStageEventListener {
67-
override fun onPresentRequestReceived() {
68-
// Called when the local user's stage access request is accepted by the host,
69-
// or when the local user, who is a viewer, is invited to the stage by the host.
64+
meeting.addStageEventListener(object : DyteStageEventListener {
65+
override fun onStageAccessRequestAccepted() {
66+
// Called when the local user is accepted to join the stage.
7067
}
7168

72-
override fun onAddedToStage() {
73-
// Called when the local user successfully joins the stage.
69+
override fun onStageAccessRequestRejected() {
70+
// Called when the local user's request to join the stage is rejected by the host.
7471
}
7572

7673
override fun onRemovedFromStage() {
7774
// Called when the local user is removed from the stage.
7875
}
7976

80-
override fun onPresentRequestAdded(participant: DyteJoinedMeetingParticipant) {
81-
// Called when a participant requests to join the stage. Triggered only if the local user is a host.
82-
}
83-
84-
override fun onPresentRequestClosed(participant: DyteJoinedMeetingParticipant) {
85-
// Called when a participant with a pending stage access request leaves the meeting.
86-
// Triggered only if the local user is a host.
87-
}
88-
89-
override fun onPresentRequestRejected(participant: DyteJoinedMeetingParticipant) {
90-
// Called when a participant's stage access request is denied by the host.
77+
override fun onNewStageAccessRequest(participant: DyteRemoteParticipant) {
78+
// Called when a new stage access request is received from a participant.
9179
// Triggered only if the local user is a host.
9280
}
9381

94-
override fun onPresentRequestWithdrawn(participant: DyteJoinedMeetingParticipant) {
95-
// Called when a participant cancels their stage access request.
82+
override fun onStageAccessRequestsUpdated(accessRequests: List<DyteRemoteParticipant>) {
83+
// Called when the list of stage access requests is updated.
9684
// Triggered only if the local user is a host.
9785
}
9886

99-
override fun onParticipantRemovedFromStage(participant: DyteJoinedMeetingParticipant) {
100-
// Called when a participant is removed from the stage by the host.
87+
override fun onStageStatusUpdated(oldStatus: StageStatus, newStatus: StageStatus) {}
88+
// Called when the local user's stage status is updated.
10189
}
10290

103-
override fun onStageRequestsUpdated(accessRequests: List<DyteJoinedMeetingParticipant>) {
104-
// Called when the list of stage access requests is updated.
91+
override fun onPeerStageStatusUpdated(
92+
participant: DyteRemoteParticipant,
93+
oldStatus: StageStatus,
94+
newStatus: StageStatus,
95+
) {
96+
// Called when a remote participant's stage status is updated.
10597
}
98+
})
99+
```
106100

107-
override fun onParticipantStartedPresenting(participant: DyteJoinedMeetingParticipant) {
108-
// Called when a participant joins the stage.
109-
}
101+
### Stage Errors
110102

111-
override fun onParticipantStoppedPresenting(participant: DyteJoinedMeetingParticipant) {
112-
// Called when a participant leaves the stage.
113-
}
103+
All the stage management APIs return a `StageError` if the operation fails. On success, they return `null`. The error type can be one of the following:
114104

115-
override fun onStageStatusUpdated(stageStatus: DyteStageStatus) {
116-
// Called when the local user's stage status is updated.
117-
}
118-
})
119-
```
105+
- `StageDisabledForMeetingType`: The meeting type does not support stage management.
106+
- `PermissionDenied`: The user does not have the required permissions to perform the operation.
107+
- `ActionInvalidForStageStatus`: The operation is invalid for the current stage status.
108+
- `NoRequestToCancel`: There is no pending request to cancel.
120109

121110
Next, we'll explore the Stage Management APIs for hosts, allowing them to manage stage requests, participants in Dyte meetings.
122111

docs/android-core/stage-management/2-host-controls.mdx

Lines changed: 20 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -7,43 +7,41 @@ tags:
77
- stage
88
---
99

10-
In a stage management-enabled meeting, a user with the `selfPermissions.host.canAcceptStageRequests` permission as `true` is
11-
considered a host. The `meeting.stage` object in Dyte's Android Core SDK provides stage management APIs that allow hosts to
10+
In a stage management-enabled meeting, a user with the `permissions.host.canAcceptStageRequests` permission as `true` is
11+
considered a host. The `meeting.stage` object in Dyte's Android Core SDK provides stage management APIs that allow hosts to
1212
manage stage access requests, invite participants to the stage, and remove participants from the stage.
1313

1414
### List of Stage Access Requests
1515

16-
You can retrieve the list of pending stage access requests by accessing the `meeting.stage.accessRequests` property. This property
17-
provides a list of `DyteJoinedMeetingParticipant` objects who have requested stage access.
16+
You can retrieve the list of pending stage access requests by accessing the `meeting.stage.accessRequests` property. This property
17+
provides a list of `DyteRemoteParticipant` objects who have requested stage access.
1818

1919
**Note**: If the local user is not a host, this property returns an empty list.
2020

2121
### Grant Access
2222

23-
To accept stage access requests or allow a participant directly to the stage, you can use the `grantAccess()` method.
24-
Alternatively, the `grantAccessAll()` method can be used to grant stage access to all participants with pending stage access requests.
23+
To accept stage access requests or allow a participant directly to the stage, you can use the `grantAccess()` method.
2524

2625
```kotlin
2726
// Grants stage access to a participant
2827
// id: peer id of the stage access requesting participant
29-
meeting.stage.grantAccess(id)
28+
meeting.stage.grantAccess(listOf(id))
3029

31-
// Grants stage access to all participants with pending stage access requests
32-
meeting.stage.grantAccessAll()
30+
// Grants stage access to all pending stage access requests
31+
meeting.stage.grantAccess(meeting.stage.accessRequests.map { it.userId })
3332
```
3433

3534
### Deny Access
3635

37-
To reject stage access requests, you can use the `denyAccess()` method. Similarly, the `denyAccessAll()` method can be used to
38-
deny all pending stage access requests.
36+
To reject stage access requests, you can use the `denyAccess()` method.
3937

4038
```kotlin
4139
// Denies stage access request of a participant
4240
// id: peer id of the stage access requesting participant
43-
meeting.stage.denyAccess(id)
41+
meeting.stage.denyAccess(listOf(id))
4442

4543
// Denies all pending stage access requests
46-
meeting.stage.denyAccessAll()
44+
meeting.stage.denyAccess(meeting.stage.accessRequests.map { it.userId })
4745
```
4846

4947
### Kick Users
@@ -53,39 +51,25 @@ You can remove a participant from the stage by using the `kick()` method.
5351
```kotlin
5452
// Kicks a participant from stage
5553
// id: peer id of the ON_STAGE participant to kick
56-
meeting.stage.kick(id)
54+
meeting.stage.kick(listOf(id))
5755
```
5856

5957
### Listening to Stage Access Requests
6058

61-
You can listen to incoming stage access requests or changes in the access requests list if you are a host. The SDK provides the
62-
following callbacks to `DyteStageEventsListener`:
59+
You can listen to incoming stage access requests or changes in the access requests list if you are a host. The SDK provides the
60+
following callbacks to `DyteStageEventListener`:
6361

6462
```kotlin
65-
meeting.addStageEventsListener(object : DyteStageEventsListener {
66-
override fun onPresentRequestAdded(participant: DyteStageParticipant) {
67-
// Called when a user is requesting to join the stage
63+
meeting.addStageEventListener(object : DyteStageEventListener {
64+
override fun onNewStageAccessRequest(participant: DyteRemoteParticipant) {
65+
// Called when a new stage access request is received from a participant.
6866
}
6967

70-
override fun onPresentRequestClosed(participant: DyteStageParticipant) {
71-
// Called when a user who was trying to join the stage leaves the call
72-
}
73-
74-
override fun onPresentRequestRejected(participant: DyteStageParticipant) {
75-
// Called when a join stage request is denied by the host
76-
}
77-
78-
override fun onPresentRequestWithdrawn(participant: DyteStageParticipant) {
79-
// Called when a user who was trying to join the stage withdraws their request to join
80-
}
81-
82-
override fun onStageRequestsUpdated(accessRequests: List<DyteJoinedMeetingParticipant>) {
83-
// Called when the access requests list is updated
68+
override fun onStageAccessRequestsUpdated(accessRequests: List<DyteRemoteParticipant>) {
69+
// Called when the list of stage access requests is updated.
8470
}
8571
})
8672
```
8773

88-
These APIs enable you to manage stage access requests and participants effectively in Dyte meetings. Next, we'll explore the
74+
These APIs enable you to manage stage access requests and participants effectively in Dyte meetings. Next, we'll explore the
8975
Stage APIs available to Viewer participants.
90-
91-

0 commit comments

Comments
 (0)