@snapcall/stream-ui 1.33.0 → 1.33.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -22
- package/dist/stream-ui.esm.js +28 -3
- package/dist/stream-ui.js +27 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# SnapCall Stream UI
|
|
2
2
|
|
|
3
3
|
The Stream UI is a library that will help you to quickly integrate [SnapCall](https://www.snapcall.io/) on your application.
|
|
4
|
+
It allows you to join a call or record media.
|
|
4
5
|
|
|
5
6
|
## Installation
|
|
6
7
|
|
|
@@ -18,28 +19,25 @@ We also distrubute a UMD build of the package, which can be used directly in the
|
|
|
18
19
|
|
|
19
20
|
## Basic usage
|
|
20
21
|
|
|
22
|
+
Depending on your Stream token you will join a call or start a media recording session.
|
|
23
|
+
|
|
21
24
|
```js
|
|
22
25
|
import { streamUI } from '@snapcall/stream-ui';
|
|
23
26
|
|
|
24
27
|
const container = document.getElementById('container');
|
|
25
28
|
const roomToken = '123';
|
|
26
29
|
|
|
27
|
-
streamUI.
|
|
28
|
-
streamUI.joinRoom(roomToken);
|
|
30
|
+
streamUI.initV2({ element: container, token: roomToken });
|
|
29
31
|
```
|
|
30
32
|
|
|
31
33
|
## Methods
|
|
32
34
|
|
|
33
|
-
### `
|
|
35
|
+
### `initV2(options: InitOptions): void`
|
|
34
36
|
|
|
35
|
-
Initializes the UI
|
|
37
|
+
Initializes the UI and start the session.
|
|
36
38
|
|
|
37
39
|
See [InitOptions](#initoptions) for more details.
|
|
38
40
|
|
|
39
|
-
### `joinRoom(token: string): Promise<void>`
|
|
40
|
-
|
|
41
|
-
Joins a room.
|
|
42
|
-
|
|
43
41
|
### `leaveRoom(): void`
|
|
44
42
|
|
|
45
43
|
Leaves a room.
|
|
@@ -48,10 +46,6 @@ Leaves a room.
|
|
|
48
46
|
|
|
49
47
|
Terminates the room, all participants will be disconnected and the room won't be usable anymore.
|
|
50
48
|
|
|
51
|
-
### `generateToken(buttonId: string): Promise<string>`
|
|
52
|
-
|
|
53
|
-
Generate a room token with a SnapCall button ID.
|
|
54
|
-
|
|
55
49
|
### `sendNotification(message: string, options: NotificationOptions): void`
|
|
56
50
|
|
|
57
51
|
Send a notification (tooltip), see [NotificationOptions](#notificationoptions) for the options.
|
|
@@ -65,7 +59,6 @@ Send a notification (tooltip), see [NotificationOptions](#notificationoptions) f
|
|
|
65
59
|
element: HTMLElement;
|
|
66
60
|
sharedURL?: string;
|
|
67
61
|
audioTiles?: boolean;
|
|
68
|
-
settingsShortcuts?: { id: string, displayType: 'icon' | 'full' }[];
|
|
69
62
|
controls?: {
|
|
70
63
|
microphone?: ControlSettings;
|
|
71
64
|
camera?: ControlSettings;
|
|
@@ -93,17 +86,9 @@ The URL used for features such as "Open new tab" or "Quick Connect".
|
|
|
93
86
|
|
|
94
87
|
Enable audio-only tiles.
|
|
95
88
|
|
|
96
|
-
#### `settingsShortcuts`
|
|
97
|
-
|
|
98
|
-
##### Default value: `[]`
|
|
99
|
-
|
|
100
|
-
Specified options are added as a small shortcut next to the menu button.
|
|
101
|
-
Type are `full` or `icon`.
|
|
102
|
-
Possible id values are: `openNewTab`, `copyLink`, `quickConnect`, `settings` and `pip`.
|
|
103
|
-
|
|
104
89
|
#### `controls`
|
|
105
90
|
|
|
106
|
-
Allows to manage the available and enabled devices
|
|
91
|
+
Allows to manage the available and enabled devices for call.
|
|
107
92
|
|
|
108
93
|
```ts
|
|
109
94
|
type Device = 'microphone' | 'camera' | 'screenshare';
|
package/dist/stream-ui.esm.js
CHANGED
|
@@ -7,7 +7,7 @@ import {useState as $3Sbms$useState, useRef as $3Sbms$useRef, useCallback as $3S
|
|
|
7
7
|
import $3Sbms$classnames from "classnames";
|
|
8
8
|
import "inobounce";
|
|
9
9
|
import {useTranslation as $3Sbms$useTranslation, initReactI18next as $3Sbms$initReactI18next, Trans as $3Sbms$Trans} from "react-i18next";
|
|
10
|
-
import {Recording3Icon as $3Sbms$Recording3Icon, InfoCircleIcon as $3Sbms$InfoCircleIcon, Speedometer4Icon as $3Sbms$Speedometer4Icon, Copy7Icon as $3Sbms$Copy7Icon, QrCode1Icon as $3Sbms$QrCode1Icon, UserPlus1Icon as $3Sbms$UserPlus1Icon, Settings1Icon as $3Sbms$Settings1Icon, PhoneCall1Icon as $3Sbms$PhoneCall1Icon, VideoRecorderIcon as $3Sbms$VideoRecorderIcon, Recording2Icon as $3Sbms$Recording2Icon, Monitor2Icon as $3Sbms$Monitor2Icon, Camera2Icon as $3Sbms$Camera2Icon, Copy5Icon as $3Sbms$Copy5Icon, CheckIcon as $3Sbms$CheckIcon, XCircleIcon as $3Sbms$XCircleIcon, Send3Icon as $3Sbms$Send3Icon, AlertTriangleIcon as $3Sbms$AlertTriangleIcon, CopyIcon as $3Sbms$CopyIcon, Link1Icon as $3Sbms$Link1Icon, VolumeMaxIcon as $3Sbms$VolumeMaxIcon, Settings3Icon as $3Sbms$Settings3Icon, UserSquareIcon as $3Sbms$UserSquareIcon, XCloseIcon as $3Sbms$XCloseIcon, ArrowLeftIcon as $3Sbms$ArrowLeftIcon, HelpCircleIcon as $3Sbms$HelpCircleIcon, SpinnerIcon as $3Sbms$SpinnerIcon, User1Icon as $3Sbms$User1Icon, Microphone1Icon as $3Sbms$Microphone1Icon, MicrophoneOff1Icon as $3Sbms$MicrophoneOff1Icon, VideoRecorderOffIcon as $3Sbms$VideoRecorderOffIcon, CameraPlusIcon as $3Sbms$CameraPlusIcon, Minimize1Icon as $3Sbms$Minimize1Icon, Maximize1Icon as $3Sbms$Maximize1Icon, CheckCircleIcon as $3Sbms$CheckCircleIcon, Download1Icon as $3Sbms$Download1Icon, RefreshCcw2Icon as $3Sbms$RefreshCcw2Icon, YoutubeIcon as $3Sbms$YoutubeIcon, Upload3Icon as $3Sbms$Upload3Icon, LogIn2Icon as $3Sbms$LogIn2Icon, FlipBackwardIcon as $3Sbms$FlipBackwardIcon, ArrowUpRightIcon as $3Sbms$ArrowUpRightIcon, PlusCircleIcon as $3Sbms$PlusCircleIcon, Star1Icon as $3Sbms$Star1Icon, ImageXIcon as $3Sbms$ImageXIcon, Upload1Icon as $3Sbms$Upload1Icon, Trash3Icon as $3Sbms$Trash3Icon, TrashIcon as $3Sbms$TrashIcon, Image1Icon as $3Sbms$Image1Icon, RefreshCw3Icon as $3Sbms$RefreshCw3Icon, Camera1Icon as $3Sbms$Camera1Icon, PlayIcon as $3Sbms$PlayIcon, QrCodeIcon as $3Sbms$QrCodeIcon, WifiOffIcon as $3Sbms$WifiOffIcon, Hourglass3Icon as $3Sbms$Hourglass3Icon, MicrophoneOffIcon as $3Sbms$MicrophoneOffIcon, MarkerPin4Icon as $3Sbms$MarkerPin4Icon, SlashCircle1Icon as $3Sbms$SlashCircle1Icon, CalendarIcon as $3Sbms$CalendarIcon, AlertCircleIcon as $3Sbms$AlertCircleIcon, Lock1Icon as $3Sbms$Lock1Icon, Lock3Icon as $3Sbms$Lock3Icon, VoicemailIcon as $3Sbms$VoicemailIcon} from "@snapcall/design-system/icons";
|
|
10
|
+
import {Recording3Icon as $3Sbms$Recording3Icon, InfoCircleIcon as $3Sbms$InfoCircleIcon, Speedometer4Icon as $3Sbms$Speedometer4Icon, Copy7Icon as $3Sbms$Copy7Icon, LinkExternal1Icon as $3Sbms$LinkExternal1Icon, QrCode1Icon as $3Sbms$QrCode1Icon, UserPlus1Icon as $3Sbms$UserPlus1Icon, Settings1Icon as $3Sbms$Settings1Icon, PhoneCall1Icon as $3Sbms$PhoneCall1Icon, VideoRecorderIcon as $3Sbms$VideoRecorderIcon, Recording2Icon as $3Sbms$Recording2Icon, Monitor2Icon as $3Sbms$Monitor2Icon, Camera2Icon as $3Sbms$Camera2Icon, Copy5Icon as $3Sbms$Copy5Icon, CheckIcon as $3Sbms$CheckIcon, XCircleIcon as $3Sbms$XCircleIcon, Send3Icon as $3Sbms$Send3Icon, AlertTriangleIcon as $3Sbms$AlertTriangleIcon, CopyIcon as $3Sbms$CopyIcon, Link1Icon as $3Sbms$Link1Icon, VolumeMaxIcon as $3Sbms$VolumeMaxIcon, Settings3Icon as $3Sbms$Settings3Icon, UserSquareIcon as $3Sbms$UserSquareIcon, XCloseIcon as $3Sbms$XCloseIcon, ArrowLeftIcon as $3Sbms$ArrowLeftIcon, HelpCircleIcon as $3Sbms$HelpCircleIcon, SpinnerIcon as $3Sbms$SpinnerIcon, User1Icon as $3Sbms$User1Icon, Microphone1Icon as $3Sbms$Microphone1Icon, MicrophoneOff1Icon as $3Sbms$MicrophoneOff1Icon, VideoRecorderOffIcon as $3Sbms$VideoRecorderOffIcon, CameraPlusIcon as $3Sbms$CameraPlusIcon, Minimize1Icon as $3Sbms$Minimize1Icon, Maximize1Icon as $3Sbms$Maximize1Icon, CheckCircleIcon as $3Sbms$CheckCircleIcon, Download1Icon as $3Sbms$Download1Icon, RefreshCcw2Icon as $3Sbms$RefreshCcw2Icon, YoutubeIcon as $3Sbms$YoutubeIcon, Upload3Icon as $3Sbms$Upload3Icon, LogIn2Icon as $3Sbms$LogIn2Icon, FlipBackwardIcon as $3Sbms$FlipBackwardIcon, ArrowUpRightIcon as $3Sbms$ArrowUpRightIcon, PlusCircleIcon as $3Sbms$PlusCircleIcon, Star1Icon as $3Sbms$Star1Icon, ImageXIcon as $3Sbms$ImageXIcon, Upload1Icon as $3Sbms$Upload1Icon, Trash3Icon as $3Sbms$Trash3Icon, TrashIcon as $3Sbms$TrashIcon, Image1Icon as $3Sbms$Image1Icon, RefreshCw3Icon as $3Sbms$RefreshCw3Icon, Camera1Icon as $3Sbms$Camera1Icon, PlayIcon as $3Sbms$PlayIcon, QrCodeIcon as $3Sbms$QrCodeIcon, WifiOffIcon as $3Sbms$WifiOffIcon, Hourglass3Icon as $3Sbms$Hourglass3Icon, MicrophoneOffIcon as $3Sbms$MicrophoneOffIcon, MarkerPin4Icon as $3Sbms$MarkerPin4Icon, SlashCircle1Icon as $3Sbms$SlashCircle1Icon, CalendarIcon as $3Sbms$CalendarIcon, AlertCircleIcon as $3Sbms$AlertCircleIcon, Lock1Icon as $3Sbms$Lock1Icon, Lock3Icon as $3Sbms$Lock3Icon, VoicemailIcon as $3Sbms$VoicemailIcon} from "@snapcall/design-system/icons";
|
|
11
11
|
import $3Sbms$i18next from "i18next";
|
|
12
12
|
import {Form as $3Sbms$Form, FormField as $3Sbms$FormField, FormItem as $3Sbms$FormItem, FormLabel as $3Sbms$FormLabel, FormControl as $3Sbms$FormControl, FormMessage as $3Sbms$FormMessage} from "@snapcall/design-system/form";
|
|
13
13
|
import {useForm as $3Sbms$useForm} from "react-hook-form";
|
|
@@ -5416,6 +5416,7 @@ const $1299919e02395903$export$c197ce1a352372f = ({ state: state })=>{
|
|
|
5416
5416
|
};
|
|
5417
5417
|
|
|
5418
5418
|
|
|
5419
|
+
|
|
5419
5420
|
const $f235befa4cdc42d6$var$multiPiP = new (0, $e96d119a19ed0c6c$export$45fabd1ce5e673de)();
|
|
5420
5421
|
const $f235befa4cdc42d6$var$browser = $3Sbms$parse(window.navigator.userAgent);
|
|
5421
5422
|
const $f235befa4cdc42d6$var$Header = ()=>{
|
|
@@ -5425,7 +5426,8 @@ const $f235befa4cdc42d6$var$Header = ()=>{
|
|
|
5425
5426
|
const inviteModalState = (0, $3Sbms$useDialogState)({});
|
|
5426
5427
|
const quickConnectDialogState = (0, $3Sbms$useDialogState)({});
|
|
5427
5428
|
const settingsDialogState = (0, $3Sbms$useDialogState)({});
|
|
5428
|
-
const
|
|
5429
|
+
const isInIframe = window.location !== window.parent.location;
|
|
5430
|
+
const showPiP = document.pictureInPictureEnabled && $f235befa4cdc42d6$var$browser.platform.type === 'desktop' && !isInIframe;
|
|
5429
5431
|
const isMedium = window.matchMedia('(min-width: 768px)').matches;
|
|
5430
5432
|
const tilesWithCamera = (0, $3Sbms$useMemo)(()=>{
|
|
5431
5433
|
return streams.filter((stream)=>stream.webcam).map((stream)=>({
|
|
@@ -5485,6 +5487,29 @@ const $f235befa4cdc42d6$var$Header = ()=>{
|
|
|
5485
5487
|
})
|
|
5486
5488
|
]
|
|
5487
5489
|
}),
|
|
5490
|
+
isInIframe && /*#__PURE__*/ (0, $3Sbms$jsxs)((0, $3Sbms$Tooltip), {
|
|
5491
|
+
children: [
|
|
5492
|
+
/*#__PURE__*/ (0, $3Sbms$jsx)((0, $3Sbms$TooltipTrigger), {
|
|
5493
|
+
asChild: true,
|
|
5494
|
+
children: /*#__PURE__*/ (0, $3Sbms$jsx)((0, $3Sbms$Button), {
|
|
5495
|
+
variant: "roundedFill",
|
|
5496
|
+
size: "sm",
|
|
5497
|
+
onClick: ()=>{
|
|
5498
|
+
window.open(options.sharedURL, '_blank', 'noopener,noreferrer');
|
|
5499
|
+
(0, $c9e496369b59be7a$export$2f377c2162fd02b2).endCall();
|
|
5500
|
+
},
|
|
5501
|
+
icon: true,
|
|
5502
|
+
children: /*#__PURE__*/ (0, $3Sbms$jsx)((0, $3Sbms$LinkExternal1Icon), {
|
|
5503
|
+
size: 16
|
|
5504
|
+
})
|
|
5505
|
+
})
|
|
5506
|
+
}),
|
|
5507
|
+
/*#__PURE__*/ (0, $3Sbms$jsx)((0, $3Sbms$TooltipContent), {
|
|
5508
|
+
sideOffset: 10,
|
|
5509
|
+
children: t('menu.openNewTab')
|
|
5510
|
+
})
|
|
5511
|
+
]
|
|
5512
|
+
}),
|
|
5488
5513
|
/*#__PURE__*/ (0, $3Sbms$jsxs)((0, $3Sbms$Tooltip), {
|
|
5489
5514
|
children: [
|
|
5490
5515
|
/*#__PURE__*/ (0, $3Sbms$jsx)((0, $3Sbms$TooltipTrigger), {
|
|
@@ -9663,7 +9688,7 @@ const $2231be1261227854$export$ca9d588768f0d0da = ({ children: children })=>{
|
|
|
9663
9688
|
});
|
|
9664
9689
|
const state = (0, $c9e496369b59be7a$export$2f377c2162fd02b2).getDevicesState();
|
|
9665
9690
|
if (hasVideo && !state.camera.enabled) await (0, $c9e496369b59be7a$export$2f377c2162fd02b2).enableVideo({
|
|
9666
|
-
resolution: '
|
|
9691
|
+
resolution: 'hd',
|
|
9667
9692
|
frameRate: 20,
|
|
9668
9693
|
facingMode: 'environment'
|
|
9669
9694
|
});
|
package/dist/stream-ui.js
CHANGED
|
@@ -5422,6 +5422,7 @@ const $e9d4b4657e98cb84$export$c197ce1a352372f = ({ state: state })=>{
|
|
|
5422
5422
|
};
|
|
5423
5423
|
|
|
5424
5424
|
|
|
5425
|
+
|
|
5425
5426
|
const $e1930b467e7d8845$var$multiPiP = new (0, $21395e477f83709c$export$45fabd1ce5e673de)();
|
|
5426
5427
|
const $e1930b467e7d8845$var$browser = $jQDcL$bowser.parse(window.navigator.userAgent);
|
|
5427
5428
|
const $e1930b467e7d8845$var$Header = ()=>{
|
|
@@ -5431,7 +5432,8 @@ const $e1930b467e7d8845$var$Header = ()=>{
|
|
|
5431
5432
|
const inviteModalState = (0, $jQDcL$snapcalldesignsystem.useDialogState)({});
|
|
5432
5433
|
const quickConnectDialogState = (0, $jQDcL$snapcalldesignsystem.useDialogState)({});
|
|
5433
5434
|
const settingsDialogState = (0, $jQDcL$snapcalldesignsystem.useDialogState)({});
|
|
5434
|
-
const
|
|
5435
|
+
const isInIframe = window.location !== window.parent.location;
|
|
5436
|
+
const showPiP = document.pictureInPictureEnabled && $e1930b467e7d8845$var$browser.platform.type === 'desktop' && !isInIframe;
|
|
5435
5437
|
const isMedium = window.matchMedia('(min-width: 768px)').matches;
|
|
5436
5438
|
const tilesWithCamera = (0, $jQDcL$react.useMemo)(()=>{
|
|
5437
5439
|
return streams.filter((stream)=>stream.webcam).map((stream)=>({
|
|
@@ -5491,6 +5493,29 @@ const $e1930b467e7d8845$var$Header = ()=>{
|
|
|
5491
5493
|
})
|
|
5492
5494
|
]
|
|
5493
5495
|
}),
|
|
5496
|
+
isInIframe && /*#__PURE__*/ (0, $jQDcL$reactjsxruntime.jsxs)((0, $jQDcL$snapcalldesignsystem.Tooltip), {
|
|
5497
|
+
children: [
|
|
5498
|
+
/*#__PURE__*/ (0, $jQDcL$reactjsxruntime.jsx)((0, $jQDcL$snapcalldesignsystem.TooltipTrigger), {
|
|
5499
|
+
asChild: true,
|
|
5500
|
+
children: /*#__PURE__*/ (0, $jQDcL$reactjsxruntime.jsx)((0, $jQDcL$snapcalldesignsystem.Button), {
|
|
5501
|
+
variant: "roundedFill",
|
|
5502
|
+
size: "sm",
|
|
5503
|
+
onClick: ()=>{
|
|
5504
|
+
window.open(options.sharedURL, '_blank', 'noopener,noreferrer');
|
|
5505
|
+
(0, $c48c1ecc38fed4e9$export$2f377c2162fd02b2).endCall();
|
|
5506
|
+
},
|
|
5507
|
+
icon: true,
|
|
5508
|
+
children: /*#__PURE__*/ (0, $jQDcL$reactjsxruntime.jsx)((0, $jQDcL$snapcalldesignsystemicons.LinkExternal1Icon), {
|
|
5509
|
+
size: 16
|
|
5510
|
+
})
|
|
5511
|
+
})
|
|
5512
|
+
}),
|
|
5513
|
+
/*#__PURE__*/ (0, $jQDcL$reactjsxruntime.jsx)((0, $jQDcL$snapcalldesignsystem.TooltipContent), {
|
|
5514
|
+
sideOffset: 10,
|
|
5515
|
+
children: t('menu.openNewTab')
|
|
5516
|
+
})
|
|
5517
|
+
]
|
|
5518
|
+
}),
|
|
5494
5519
|
/*#__PURE__*/ (0, $jQDcL$reactjsxruntime.jsxs)((0, $jQDcL$snapcalldesignsystem.Tooltip), {
|
|
5495
5520
|
children: [
|
|
5496
5521
|
/*#__PURE__*/ (0, $jQDcL$reactjsxruntime.jsx)((0, $jQDcL$snapcalldesignsystem.TooltipTrigger), {
|
|
@@ -9669,7 +9694,7 @@ const $a33432a0233f49a9$export$ca9d588768f0d0da = ({ children: children })=>{
|
|
|
9669
9694
|
});
|
|
9670
9695
|
const state = (0, $c48c1ecc38fed4e9$export$2f377c2162fd02b2).getDevicesState();
|
|
9671
9696
|
if (hasVideo && !state.camera.enabled) await (0, $c48c1ecc38fed4e9$export$2f377c2162fd02b2).enableVideo({
|
|
9672
|
-
resolution: '
|
|
9697
|
+
resolution: 'hd',
|
|
9673
9698
|
frameRate: 20,
|
|
9674
9699
|
facingMode: 'environment'
|
|
9675
9700
|
});
|