Skip to content

Commit 7a5192b

Browse files
authored
Merge pull request #567 from GetStream/async-voice-message
Async voice message
2 parents 547a918 + 930b224 commit 7a5192b

25 files changed

+1002
-46
lines changed
29.1 KB
Loading
28.2 KB
Loading

docusaurus/docs/Angular/components/AttachmentListComponent.mdx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import AttachmentsScreenshot from "../assets/attachments-screenshot.png";
2+
import VoiceRecordingScreenshot from "../assets/voice-recording-screenshot.png";
23
import ImageSizingScreenshot1 from "../assets/image-sizing-screenshot-1.png";
34
import ImageSizingScreenshot2 from "../assets/image-sizing-screenshot-2.png";
45
import ImageSizingScreenshot3 from "../assets/image-sizing-screenshot-3.png";
@@ -8,13 +9,18 @@ The `AttachmentList` component displays the attachments of a message. The follow
89

910
- Images (including GIFs) are displayed inline
1011
- Videos are displayed inline
12+
- Voice recordings are displayed inline (the Angular SDK doesn't support recording, only playback)
1113
- Other files can be downloaded
1214
- Links in a message are enriched with built-in open graph URL scraping
1315

1416
**Example 1** - different type of attachments:
1517

1618
<img src={AttachmentsScreenshot} width="500" />
1719

20+
**Example 2** - voice recording:
21+
22+
<img src={VoiceRecordingScreenshot} width="500" />
23+
1824
## Basic Usage
1925

2026
A typical use case for the `AttachmentList` component would be to use in your custom components that will completely override the message component.
@@ -50,6 +56,7 @@ You can override attachment display by attachment types, here are the available
5056
- [Gallery image](../services/CustomTemplatesService.mdx/#galleryattachmenttemplate): this template is used if a message has multiple image attachments, the template will receive all image attachments. Please note that your template is responsible for proper image sizing (see below).
5157
- [Video attachment](../services/CustomTemplatesService.mdx/#videoattachmenttemplate): this template is used to display video attachments. Please note that your template is responsible for proper image sizing (see below).
5258
- [File attachment](../services/CustomTemplatesService.mdx/#fileattachmenttemplate): this template is used to display file type attachments
59+
- [Voice recording](../services/CustomTemplatesService.mdx/#voicerecordingattachmenttemplate): this template is used to display voice recordings
5360
- [Card attachment](../services/CustomTemplatesService.mdx/#cardattachmenttemplate): this template is used to display GIFs or open graph URL data
5461
- [Attachment actions](../services/CustomTemplatesService.mdx/#attachmentactionstemplate): this template is used to display attachment actions
5562

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
import VoiceRecordingScreenshot from "../assets/voice-recording-screenshot.png";
2+
3+
This component can be used to display an attachment with type `voiceRecording`. The component allows playing the attachment inside the browser.
4+
5+
<img src={VoiceRecordingScreenshot} width="500" />
6+
7+
## Usage
8+
9+
The built-in [`AttachmentListComponent`](../../components/AttachmentListComponent) displays this component. If you want to use this directly in your UI you can do it like this:
10+
11+
```html
12+
<stream-voice-recording [attachment]="attachment"></stream-voice-recording>
13+
```
14+
15+
## Customization
16+
17+
You can provide your own template using the [custom templates service](../services/CustomTemplatesService.mdx/#voicerecordingattachmenttemplate).
18+
19+
## Example
20+
21+
An example voice recording attachment:
22+
23+
```typescript
24+
{
25+
type: 'voiceRecording',
26+
title: '99831FB3-5E35-41CD-8286-7A2E95A78FDC.aac',
27+
asset_url:
28+
'<link to file on Stream or custom CDN>',
29+
waveform_data: [
30+
0.18580253422260284, 0.22792305052280426, 0.23014479875564575,
31+
0.2215365618467331, 0.280057817697525, 0.24526794254779816,
32+
0.23399925231933594, 0.3128012716770172, 0.37945452332496643,
33+
0.33992674946784973, 0.33231520652770996, 0.35996779799461365,
34+
0.24952147901058197, 0.2771506607532501, 0.18567748367786407,
35+
0.2669936418533325, 0.2318495213985443, 0.266754150390625,
36+
0.24599547684192657, 0.22025825083255768, 0.2574225664138794,
37+
0.2297886610031128, 0.21858176589012146, 0.22855964303016663,
38+
0.21926963329315186, 0.1592704802751541, 0.17932571470737457,
39+
0.17183426022529602, 0.16925041377544403, 0.17725585401058197,
40+
0.20863258838653564, 0.15763725340366364, 0.17838287353515625,
41+
0.2596689462661743, 0.2821672856807709, 0.2308555543422699,
42+
0.21800407767295837, 0.237264484167099, 0.24341285228729248,
43+
0.21091987192630768, 0.22752471268177032, 0.28887689113616943,
44+
0.25566428899765015, 0.2714449167251587, 0.30015745759010315,
45+
0.2883681356906891, 0.28020721673965454, 0.21566811203956604,
46+
0.2041303962469101, 0.1856091320514679, 0.22570304572582245,
47+
0.22362418472766876, 0.18938171863555908, 0.2105405479669571,
48+
0.22487449645996094, 0.2667095959186554, 0.29159706830978394,
49+
0.2825489938259125, 0.2347666174173355, 0.2768406569957733,
50+
0.2953290641307831, 0.26249200105667114, 0.3034127950668335,
51+
0.26899436116218567, 0.2931807041168213, 0.24274344742298126,
52+
0.23544998466968536, 0.29423996806144714, 0.2060961127281189,
53+
0.05098915100097656, 0.0063146972097456455, 0.015633393079042435,
54+
0.03022758476436138, 0.026124343276023865, 0.014958725310862064,
55+
0.01488060038536787, 0.0297449491918087, 0.046876221895217896,
56+
0.016678161919116974, 0.030463561415672302, 0.022851256653666496,
57+
0.040972135961055756, 0.050609588623046875, 0.04940780624747276,
58+
0.04304153472185135, 0.08744628727436066, 0.0762052908539772,
59+
0.0801474004983902, 0.0818980410695076, 0.08521285653114319,
60+
0.07830711454153061, 0.07637504488229752, 0.09124496579170227,
61+
0.16371025145053864, 0.08206146210432053, 0.0569305419921875,
62+
0.043944090604782104, 0.07224594056606293, 0.06922554224729538,
63+
5.340576194612368e-7,
64+
],
65+
// in seconds
66+
duration: 21.07675,
67+
// in bytes
68+
file_size: 56504,
69+
mime_type: 'audio/aac',
70+
};
71+
```
72+
73+
[//]: # "Start of generated content"
74+
[//]: # "End of generated content"
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import WavebarScreenshot from "../assets/wavebar-screenshot.png";
2+
3+
This component can be used to visualize the wave bar of a voice recording
4+
5+
<img src={WavebarScreenshot} width="500" />
6+
7+
## Usage
8+
9+
The built-in [`AttachmentListComponent`](../../components/AttachmentListComponent) component displays this component. If you want to use this directly in your UI you can do it like this:
10+
11+
```html
12+
<audio #audioElement></audio>
13+
<stream-voice-recording-wavebar
14+
*ngIf="attachment?.waveform_data && attachment?.duration"
15+
[waveFormData]="attachment?.waveform_data || []"
16+
[duration]="attachment?.duration"
17+
[audioElement]="audioElement"
18+
></stream-voice-recording-wavebar>
19+
```
20+
21+
## Customization
22+
23+
It's not possible to override only the wave data visualization, but you can override the [`VoiceRecordingComponent`](../services/CustomTemplatesService.mdx/#voicerecordingattachmenttemplate).
24+
25+
[//]: # "Start of generated content"
26+
[//]: # "End of generated content"

docusaurus/shared

Lines changed: 0 additions & 1 deletion
This file was deleted.

package-lock.json

Lines changed: 14 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117
"@ngx-translate/core": "^13.0.0",
118118
"@ngx-translate/http-loader": "^6.0.0",
119119
"@popperjs/core": "^2.11.5",
120-
"@stream-io/stream-chat-css": "4.9.2",
120+
"@stream-io/stream-chat-css": "4.10.1",
121121
"@stream-io/transliterate": "^1.5.2",
122122
"angular-mentions": "^1.4.0",
123123
"dayjs": "^1.10.7",
@@ -126,7 +126,7 @@
126126
"ngx-popperjs": "^12.2.2",
127127
"pretty-bytes": "^5.6.0",
128128
"rxjs": "^7.1.0",
129-
"stream-chat": "^8.20.0",
129+
"stream-chat": "^8.24.0",
130130
"ts-node": "^10.2.1",
131131
"tslib": "^2.3.0",
132132
"uuidv4": "^6.2.12",

projects/stream-chat-angular/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"@angular/common": "^12.2.0 || ^13.0.0 || ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0",
1313
"@angular/core": "^12.2.0 || ^13.0.0 || ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0",
1414
"@ngx-translate/core": "^13.0.0 || ^14.0.0 || ^15.0.0",
15-
"stream-chat": "^8.20.0"
15+
"stream-chat": "^8.24.0"
1616
},
1717
"dependencies": {
1818
"angular-mentions": "^1.4.0",

projects/stream-chat-angular/src/assets/i18n/en.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,5 +118,6 @@ export const en = {
118118
'This message did not meet our content guidelines',
119119
'Send Anyway': 'Send Anyway',
120120
Edited: 'Edited',
121+
'Error playing audio': 'Error playing audio',
121122
},
122123
};

0 commit comments

Comments
 (0)