Skip to content

Commit dffabe6

Browse files
authored
Merge pull request #210719 from rzdor/main
Documentation for Raise Hand
2 parents dda85d5 + 46792a9 commit dffabe6

File tree

2 files changed

+120
-0
lines changed

2 files changed

+120
-0
lines changed
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
---
2+
author: ruslanzdor
3+
ms.service: azure-communication-services
4+
ms.topic: include
5+
ms.date: 09/08/2022
6+
ms.author: rifox
7+
---
8+
[!INCLUDE [Install SDK](../install-sdk/install-sdk-web.md)]
9+
10+
> [!NOTE]
11+
> Raise Hand API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. To use this api please use 'beta' release of Azure Communication Services Calling Web SDK
12+
13+
Raise Hand is an extended feature of the core `Call` API. You first need to import calling Features from the Calling SDK:
14+
15+
```js
16+
import { Features} from "@azure/communication-calling";
17+
```
18+
19+
Then you can get the feature API object from the call instance:
20+
21+
```js
22+
const raiseHandFeature = call.feature(Features.RaiseHand );
23+
```
24+
25+
### Raise and lower hand for current participant:
26+
Raise Hand state can be used in any call type: on 1:1 calls and on calls with many participants, in ACS and in Teams calls.
27+
If it Teams meeting - organizer will have ability to enable or disable raise hand states for all participants.
28+
To change state for current participant, you can use methods:
29+
```js
30+
const raiseHandFeature = call.feature(Features.RaiseHand );
31+
//raise
32+
raiseHandFeature.raiseHand();
33+
//lower
34+
raiseHandFeature.lowerHand();
35+
```
36+
37+
### Lower hands for other participants
38+
Currently ACS calls aren't allowed to change state of other participants, for example, lower all hands. But Teams calls allow it using these methods:
39+
```js
40+
const raiseHandFeature = call.feature(Features.RaiseHand );
41+
//lower all hands on the call
42+
raiseHandFeature.lowerHandForEveryone();
43+
//or we can provide array of CommunicationIdentifier to specify list of participants
44+
CommunicationUserIdentifier acsUser = new CommunicationUserIdentifier(<USER_ID>);
45+
MicrosoftTeamsUserIdentifier teamsUser = new MicrosoftTeamsUserIdentifier(<USER_ID>)
46+
CommunicationIdentifier participants[] = new CommunicationIdentifier[]{ acsUser, teamsUser };
47+
raiseHandFeature.lowerHand(participants);
48+
```
49+
50+
### Handle changed states
51+
The `Raise Hand` API allows you to subscribe to `raiseHandChanged` events. A `raiseHandChanged` event comes from a `call` instance and contain information about participant and new state.
52+
```js
53+
const raiseHandFeature = call.feature(Features.RaiseHand );
54+
55+
// event : {identifier: CommunicationIdentifier, isRaised: true, order:1}
56+
const isRaiseHandChangedHandler = (event) => {
57+
console.log(`Participant ${event.identifier} ${event.isRaised ? "Raised" : "Lower"} hand`);
58+
};
59+
raiseHandFeature.feature(SDK.Features.RaiseHand).on('raiseHandChanged', isRaiseHandChangedHandler):
60+
```
61+
62+
### List of all participants with active state
63+
To get information about all participants that have Raise Hand state on current call, you can use this api array is sorted by order field:
64+
```js
65+
const raiseHandFeature = call.feature(Features.RaiseHand );
66+
let activeStates = raiseHandFeature.getStatus();
67+
```
68+
69+
### Order of raised Hands
70+
It possible to get order of all raised hand states on the call, this order is started from 1.
71+
There are two ways: get all raise hand state on the call or use `raiseHandChanged` event subscription.
72+
In event subscription when any participant will lower a hand - call will generate only one event, but not for all participants with order above.
73+
74+
```js
75+
const raiseHandFeature = call.feature(Features.RaiseHand );
76+
77+
// event : {identifier: CommunicationIdentifier, isRaised: true, order:1}
78+
const isRaiseHandChangedHandler = (event) => {
79+
console.log(`List of participants with raised hand`);
80+
for (let state : raiseHandFeature.getStatus()) {
81+
console.log(`Participant ${state.identifier} has order ${state.order}`);
82+
}
83+
};
84+
raiseHandFeature.feature(SDK.Features.RaiseHand).on('raiseHandChanged', isRaiseHandChangedHandler):
85+
```
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
title: Raise hand states
3+
titleSuffix: An Azure Communication Services how-to guide
4+
description: Use Azure Communication Services SDKs to send raise hand state.
5+
author: rzdor
6+
ms.author: ruslanzdor
7+
ms.service: azure-communication-services
8+
ms.subservice: calling
9+
ms.topic: how-to
10+
ms.date: 09/09/2022
11+
ms.custom: template-how-to
12+
13+
#Customer intent: As a developer, I want to learn how to send and receive Raise Hand state using SDK.
14+
---
15+
16+
# Raise hand states
17+
18+
[!INCLUDE [Public Preview Disclaimer](../../includes/public-preview-include-document.md)]
19+
20+
During an active call, you may want to send or receive states from other users. Let's learn how.
21+
22+
## Prerequisites
23+
24+
- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
25+
- A deployed Communication Services resource. [Create a Communication Services resource](../../quickstarts/create-communication-resource.md).
26+
- A user access token to enable the calling client. For more information, see [Create and manage access tokens](../../quickstarts/access-tokens.md).
27+
- Optional: Complete the quickstart to [add voice calling to your application](../../quickstarts/voice-video-calling/getting-started-with-calling.md)
28+
29+
[!INCLUDE [Raise Hand Client-side JavaScript](./includes/raise-hand/raise-hand-web.md)]
30+
31+
## Next steps
32+
- [Learn how to manage calls](./manage-calls.md)
33+
- [Learn how to manage video](./manage-video.md)
34+
- [Learn how to record calls](./record-calls.md)
35+
- [Learn how to transcribe calls](./call-transcription.md)

0 commit comments

Comments
 (0)