Skip to content

Commit c3cd93b

Browse files
authored
Merge pull request #259882 from KaranMish/main
Local Recording Feature for ACS Web SDK Quickstarts
2 parents c82f7b9 + ee0f511 commit c3cd93b

File tree

3 files changed

+99
-1
lines changed

3 files changed

+99
-1
lines changed
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
---
2+
author: karanmish
3+
title: Local recording notification for Teams
4+
titleSuffix: An Azure Communication Services tutorials document
5+
description: Show local recording notifications to users joining Teams calls or Teams meetings
6+
ms.subservice: teams-interop
7+
ms.service: azure-communication-services
8+
ms.topic: tutorial
9+
ms.date: 09/08/2021
10+
ms.author: karanmishra
11+
---
12+
13+
### Local recording notification for Teams
14+
15+
Terms of use for Azure Communication Services require developers to show notification to the users, if they are being recorded. Microsoft Teams application allows Teams users to record Teams calls and Teams meetings in the cloud and on Teams desktop app also locally. Developers can use Azure Communication Services Calling SDK to identify whether local or cloud recording has started or stopped.
16+
17+
Azure Communication Services Calling SDK provides object `Call` to manage calls, that has dedicated features for local recording `LocalRecordingCallFeature` and cloud recording `RecordingCallFeature `. Developers need to implement both features to provide a compliant solution.
18+
You first need to import calling Features from the Calling SDK:
19+
20+
```js
21+
import { Features} from "@azure/communication-calling";
22+
```
23+
24+
Then you can get the local recording feature API object from the call instance:
25+
26+
```js
27+
const localCallRecordingApi = call.feature(Features.LocalRecording);
28+
```
29+
30+
Then, to check if the call is being recorded locally, inspect the `isLocalRecordingActive` property of `localCallRecordingApi`. It returns `Boolean`.
31+
32+
```js
33+
const isLocalRecordingActive = localCallRecordingApi.isLocalRecordingActive;
34+
```
35+
36+
You can also get a list of local recordings by using the `localRecordings` property of `localCallRecordingApi`. It returns `LocalRecordingInfo[]` which will have the displayName of the user and current state of the local recording.
37+
38+
```js
39+
const recordings = localCallRecordingApi.localRecordings;
40+
41+
recordings.forEach(r => {
42+
console.log("User: ${r.displayName}, State: ${r.state});
43+
```
44+
45+
You can subscribe to recording changes:
46+
47+
```js
48+
const isLocalRecordingActiveChangedHandler = () => {
49+
console.log(localCallRecordingApi.isLocalRecordingActive);
50+
};
51+
52+
localCallRecordingApi.on('isLocalRecordingActiveChanged', isLocalRecordingActiveChangedHandler);
53+
```
54+
55+
You can also subscribe to `localRecordingsUpdated` and get a collection of updated recordings. This event is triggered whenever there is a recording update
56+
57+
```js
58+
const localRecordingsUpdatedHandler = (args: { added: SDK.LocalRecordingInfo[], removed: SDK.LocalRecordingInfo[]}) => {
59+
console.log('Local recording started by: ');
60+
args.added?.forEach(a => {
61+
console.log('User: ${a.displayName}');
62+
});
63+
64+
console.log('Local recording stopped by: ');
65+
args.removed?.forEach(r => {
66+
console.log('User: ${r.displayName});
67+
});
68+
};
69+
localCallRecordingApi.on('localRecordingsUpdated', localRecordingsUpdatedHandler);
70+
```

articles/communication-services/how-tos/calling-sdk/includes/record-calls/record-calls-web.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ ms.author: rifox
77
---
88
[!INCLUDE [Install SDK](../install-sdk/install-sdk-web.md)]
99

10-
### Record calls
1110
> [!NOTE]
1211
> This 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.
1312
13+
### Cloud Recording
14+
1415
Call recording is an extended feature of the core `Call` API. You first need to import calling Features from the Calling SDK:
1516

1617
```js
@@ -38,3 +39,29 @@ const isRecordingActiveChangedHandler = () => {
3839

3940
callRecordingApi.on('isRecordingActiveChanged', isRecordingActiveChangedHandler);
4041
```
42+
43+
You can also get a list of recordings by using the `recordings` property of `callRecordingApi`. It returns `RecordingInfo[]` which will have the displayName of the user and current state of the cloud recording.
44+
45+
```js
46+
const recordings = callRecordingApi.recordings;
47+
48+
recordings.forEach(r => {
49+
console.log("User: ${r.displayName}, State: ${r.state});
50+
```
51+
52+
You can also subscribe to 'recordingsUpdated' and get a collection of updated recordings. This event is triggered whenever there is a recording update
53+
54+
```js
55+
const cloudRecordingsUpdatedHandler = (args: { added: SDK.RecordingInfo[], removed: SDK.RecordingInfo[]}) => {
56+
console.log('Recording started by: ');
57+
args.added?.forEach(a => {
58+
console.log('User: ${a.displayName}');
59+
});
60+
61+
console.log('Recording stopped by: ');
62+
args.removed?.forEach(r => {
63+
console.log('User: ${r.displayName});
64+
});
65+
};
66+
callRecordingApi.on('recordingsUpdated', cloudRecordingsUpdatedHandler );
67+
```

articles/communication-services/how-tos/calling-sdk/record-calls.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ zone_pivot_groups: acs-plat-web-ios-android-windows
2929

3030
::: zone pivot="platform-web"
3131
[!INCLUDE [Record Calls Client-side JavaScript](./includes/record-calls/record-calls-web.md)]
32+
[!INCLUDE [Local Recording Notification for Teams JavaScript](./includes/record-calls/record-calls-locally-web.md)]
3233
::: zone-end
3334

3435
::: zone pivot="platform-android"

0 commit comments

Comments
 (0)