Skip to content

Commit 5d5457f

Browse files
Merge pull request #298448 from tayaras/main
Add Web Sections, Update Language and Fix Formatting in RTT Docs
2 parents 72f5f63 + 6ce98a5 commit 5d5457f

File tree

4 files changed

+155
-28
lines changed

4 files changed

+155
-28
lines changed

articles/communication-services/concepts/voice-video-calling/real-time-text.md

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,62 +9,43 @@ ms.topic: conceptual
99
ms.service: azure-communication-services
1010
ms.subservice: calling
1111
---
12-
13-
14-
15-
1612
# Real Time Text (RTT) Overview
17-
1813
>[!NOTE]
1914
>RTT is an accessibility compliance requirement for voice and video platforms in the EU starting June 30, 2025. You can find more information about this here: [Directive 2019/882](https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=CELEX%3A32019L0882)
2015
2116
Real Time Text (RTT) provides developers with the ability to transmit text in near real-time during a call. This feature is designed to empower individuals who have difficulty speaking, ensuring their text messages are displayed prominently to other meeting participants, similar to spoken communication. RTT enhances accessibility by allowing participants to communicate effectively through typed messages that are broadcast instantly character by character, without having to press a "send" key.
2217

2318
## Common Use Cases
24-
2519
### Building Accessible Experiences
26-
2720
RTT aids in creating inclusive communication platforms by enabling users with speech impairments to participate fully in calls. By providing a text-based communication channel that operates in real-time, RTT ensures that all participants can engage equally, regardless of their ability to speak.
28-
2921
### Enhancing Communication Clarity
30-
3122
In scenarios where speech clarity is compromised due to background noise or technical limitations, RTT serves as a reliable alternative to convey messages clearly. This ensures that critical information is communicated without misunderstandings.
32-
3323
## When to Use Real Time Text (RTT)
34-
3524
- **Accessibility Requirements:** When developing applications that need to comply with accessibility standards, enabling RTT ensures that users with speech difficulties can participate effectively.
3625
- **High-Noise Environments:** In settings where audio quality may be affected by background noise, RTT provides a clear and reliable means of communication.
37-
3826
## RealTimeTextInfo/Details Class
39-
4027
The `RealTimeTextInfo` (or `RealTimeTextDetails` on certain platforms) class is pivotal in managing RTT messages. It encapsulates all necessary information about each RTT message, including the sender, content, sequence identifier, result type, timestamps, and whether the message originates locally.
41-
4228
### Properties and Fields
43-
4429
- **Sender:** Provides information about the user who sent the RTT message.
4530
- **SequenceId:** A unique identifier that maintains the order of messages.
4631
- **Text:** The actual content of the RTT message.
4732
- **ResultType/Kind:** Indicates whether the message is partial (`ResultType`) or finalized (`Kind`), determining if it can be edited.
4833
- **ReceivedTime:** Timestamp marking when the message was received.
4934
- **UpdatedTime:** Timestamp indicating the last update to the message.
5035
- **IsLocal:** A boolean flag indicating if the message was sent by the local user.
51-
5236
### Usage
53-
5437
Developers can subscribe to RTT events through a single event subscription, allowing them to manage their own list and ordering of RTT messages. This approach aligns with the Captions API, facilitating easier integration and maintenance. The UI is responsible for binding the data to the screen, managing the display list, and handling text input interactions based on message finalization.
5538

5639
>[!NOTE]
57-
>RTT Teams Interlop is not functional yet.
40+
>RTT for PSTN or Teams Interop scenarios is not available at this time.
5841
5942
### Privacy Concerns
6043
Real-Time Text (RTT) is only available during the call or meeting. Azure Communication Services doesn't store these text exchanges anywhere. Many countries/regions and states have laws and regulations that apply to the storing of data. It is your responsibility to use RTT in compliance with the law should you choose to store any of the data generated through RTT. You must obtain consent from the parties involved in a manner that complies with the laws applicable to each participant.
61-
6244
Interoperability between Azure Communication Services and Microsoft Teams enables your applications and users to participate in Teams calls, meetings, and chats. It is your responsibility to ensure that the users of your application are notified when RTT is enabled in a Teams call or meeting and being stored.
63-
6445
Microsoft indicates to you via the Azure Communication Services API that recording or RTT has commenced, and you must communicate this fact, in real-time, to your users within your application's user interface. You agree to indemnify Microsoft for all costs and damages incurred due to your failure to comply with this obligation.
6546

6647
## Next Steps
6748

68-
- Get started with a [Quickstart Guide](../../quickstarts/voice-video-calling/get-started-with-real-time-text.md)
49+
- Get started with our [Quickstart Guide](../../quickstarts/voice-video-calling/get-started-with-real-time-text.md)
6950
- Learn more about [Closed captions](../../concepts/voice-video-calling/closed-captions.md)
70-
- Explore the [UI Library](../ui-library/ui-library-overview.md)
51+
- Get started with RTT in the [UI Library](../ui-library/ui-library-overview.md)

articles/communication-services/quickstarts/voice-video-calling/get-started-with-real-time-text.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,13 @@ ms.subservice: calling
99
ms.topic: how-to
1010
ms.date: 12/4/2024
1111
ms.custom: template-how-to
12-
zone_pivot_groups: acs-programming-languages-java-swift-csharp
12+
zone_pivot_groups: acs-programming-languages-javascript-java-swift-csharp
1313
---
1414

1515

1616

1717
# Quickstart RTT within your application
1818

19-
[!INCLUDE [Public Preview Disclaimer](../../includes/public-preview-include-document.md)]
20-
2119
>[!NOTE]
2220
>RTT is an accessibility compliance requirement for voice and video platforms in the EU starting June 30, 2025. You can find more information about this here: [Directive 2019/882](https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=CELEX%3A32019L0882).
2321
@@ -32,7 +30,7 @@ Real Time Text (RTT) is designed to facilitate communication for users who may h
3230
On supported platforms, RTT data can be displayed alongside captions derived from Speech to Text, providing a comprehensive view of all communications during a call.
3331

3432
>[!NOTE]
35-
>RTT Teams Interlop is not functional yet.
33+
>RTT for PSTN or Teams Interop is not available at this time
3634
3735
## Naming Conventions
3836

@@ -60,6 +58,11 @@ The `RealTimeTextInfo` (or `RealTimeTextDetails` on Windows) class encapsulates
6058
| `UpdatedTime` | Timestamp when the message was last updated. |
6159

6260

61+
62+
::: zone pivot="programming-language-javascript"
63+
[!INCLUDE [Real Time Text with Web](./includes/real-time-text/real-time-text-web.md)]
64+
::: zone-end
65+
6366
::: zone pivot="programming-language-java"
6467
[!INCLUDE [Real Time Text with Android](./includes/real-time-text/real-time-text-android.md)]
6568
::: zone-end
@@ -76,5 +79,6 @@ The `RealTimeTextInfo` (or `RealTimeTextDetails` on Windows) class encapsulates
7679
## Next steps
7780

7881
For more information, see the following articles:
79-
- [Real Time Text Conceptual Doc](../../concepts/voice-video-calling/real-time-text.md)
80-
- [Azure Communication Services Calling Documentation](../../concepts/voice-video-calling/calling-sdk-features.md)
82+
- Learn more about RTT in our [Real Time Text Conceptual Doc](../../concepts/voice-video-calling/real-time-text.md)
83+
- Learn more with our [Azure Communication Services Calling Documentation](../../concepts/voice-video-calling/calling-sdk-features.md)
84+
- Learn more about [Closed captions](../../concepts/voice-video-calling/closed-captions.md)
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
---
2+
author: Edward
3+
ms.service: azure-communication-services
4+
ms.subservice: calling
5+
ms.topic: include
6+
ms.date: 12/4/2024
7+
ms.author: edwardlee
8+
---
9+
10+
## Models
11+
| Name | Description |
12+
| ---- | ----------- |
13+
| RealTimeTextFeature | API for RealTimeText |
14+
| RealTimeTextInfo | Data structure received for each RealTimeText event |
15+
| RealTimeTextReceivedEventHandler | Callback definition for handling RealTimeTextReceivedEventType event |
16+
17+
## Get RealTimeText feature
18+
19+
``` typescript
20+
let realTimeTextFeature: SDK.RealTimeTextFeature = call.feature(SDK.Features.RealTimeText);
21+
```
22+
23+
## Subscribe to listeners
24+
25+
### Add a listener for RealTimeText data received
26+
Handle the returned RealTimeTextInfo data object. Ideally, you would have this on handler set once call is connected.
27+
28+
Note: The object contains a resultType prop that indicates whether the data is a partial text or a finalized version of the text. ResultType `Partial` indicates live messages that are subject to change, while `Final` indicates completed messages with no further changes pending.
29+
30+
```typescript
31+
const realTimeTextReceivedHandler: SDK.RealTimeTextReceivedEventHandler = (data: SDK.RealTimeTextInfo) => {
32+
    /** USER CODE HERE - E.G. RENDER TO DOM
33+
     *  data.sequenceId
34+
     *  data.sender
35+
     *  data.text
36+
     *  data.resultType
37+
     *  data.receivedTimestamp
38+
     *  data.updatedTimestamp
39+
     *  data.isLocal
40+
    */
41+
    // Example code:
42+
    // Create a dom element, i.e. div, with id "rttArea" before proceeding with the sample code
43+
    let mri: string = '';
44+
    let displayName: string = '';
45+
    switch (data.sender.identifier.kind) {
46+
        case 'communicationUser': { mri = data.sender.identifier.communicationUserId; displayName = data.sender.displayName; break; }
47+
        case 'microsoftTeamsUser': { mri = data.sender.identifier.microsoftTeamsUserId; displayName = data.sender.displayName; break; }
48+
        case 'phoneNumber': { mri = data.sender.identifier.phoneNumberdisplayName = data.sender.displayName; break; }
49+
    }
50+
51+
    const newClassName = `prefix${mri.replace(/:/g, '').replace(/-/g, '').replace(/\+/g, '')}`;
52+
    const rttText = `${(data.receivedTimestamp).toUTCString()} ${displayName ?? mri}: `;
53+
54+
    let foundRTTContainer = this.elements.rttArea.querySelector(`.${newClassName}[isNotFinal='true']`);
55+
    if (!foundRTTContainer) {
56+
        let rttContainer = document.createElement('div');
57+
        rttContainer.setAttribute('isNotFinal', 'true');
58+
        rttContainer.style['borderBottom'] = '1px solid';
59+
        rttContainer.style['whiteSpace'] = 'pre-line';
60+
        rttContainer.textContent = rttText + data.text;
61+
        rttContainer.classList.add(newClassName);
62+
63+
        this.elements.rttArea.appendChild(rttContainer);
64+
65+
        setTimeout(() => {
66+
            this.elements.rttArea.removeChild(rttContainer);
67+
        }, 40000);
68+
    } else {
69+
        if (data.text === '') {
70+
            this.elements.rttArea.removeChild(foundRTTContainer);
71+
        }
72+
        if (data.resultType === 'Final') {
73+
            foundRTTContainer.setAttribute('isNotFinal', 'false');
74+
            if (data.isLocal) {
75+
                let rttTextField = this.elements.rttMessage;
76+
                rttTextField.value = '';
77+
            }
78+
        } else {
79+
            foundRTTContainer.textContent = rttText + data.text;
80+
        }
81+
    }
82+
};
83+
realTimeTextFeature.on('realTimeTextReceived', realTimeTextReceivedHandler);
84+
```
85+
86+
## Send RealTimeText live handler
87+
In order to simulate live messaging, you will need to set up a live handler to send RealTimeText as the user types.
88+
89+
```typescript
90+
let rttTextField = document.getElementById("rttMessage") as HTMLInputElement;
91+
rttTextField.addEventListener('keyup', (event) => {
92+
    await realTimeTextFeature.sendRealTimeText(rttTextField.value);
93+
});
94+
```
95+
96+
### Send Finalized RealTimeText
97+
Once you are certain that the message has been finalized, for example, the user clicks on send message or presses enter, pass `true` to the sendRealTimeText function.
98+
``` typescript
99+
try {
100+
    let rttTextField = document.getElementById("rttMessage") as HTMLInputElement;
101+
    await realTimeTextFeature.sendRealTimeText(rttTextField.value, true);
102+
    rttTextField.value = '';
103+
} catch (e) {
104+
    console.log('ERROR Send RTT failed', e);
105+
}
106+
```
107+
108+
## Unsubscribe to listeners
109+
```typescript
110+
realTimeTextFeature.off('realTimeTextReceived', realTimeTextReceivedHandler);
111+
```
112+
113+
## RealTimeTextInfo Class
114+
115+
The `RealTimeTextInfo` class provides detailed information about each real-time text message:
116+
117+
- **sender**: Information about who sent the message.
118+
- **sequenceId**: Unique identifier for the message.
119+
- **text**: The content of the message.
120+
- **resultType**: Indicates if the message is partial or finalized.
121+
- **receivedTimestamp**: Timestamp when the message was received.
122+
- **updatedTimestamp**: Timestamp when the message was last updated.
123+
- **isLocal**: Indicates if the message was sent by the local user.
124+
125+
## Other Links
126+
127+
- Get started with RTT in the [UI Library](https://azure.github.io/communication-ui-library/?path=/docs/concepts-real-time-text--docs)

articles/zone-pivot-groups.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1396,6 +1396,21 @@ groups:
13961396
title: iOS
13971397
- id: programming-language-java
13981398
title: Android
1399+
1400+
# Owners: tayaras
1401+
- id: acs-programming-languages-javascript-java-swift-csharp
1402+
title: Programming languages
1403+
prompt: Choose a programming language
1404+
pivots:
1405+
- id: programming-language-javascript
1406+
title: Web
1407+
- id: programming-language-csharp
1408+
title: Windows
1409+
- id: programming-language-swift
1410+
title: iOS
1411+
- id: programming-language-java
1412+
title: Android
1413+
13991414
- id: acs-programming-languages-support-kotlin-swift
14001415
title: Programming languages
14011416
prompt: Choose a programming language

0 commit comments

Comments
 (0)