@apple-pie/slice 0.1.22 → 0.1.24
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/dist/cjs/chunks/AudioBubble-C8HdYBY8.js +54 -0
- package/dist/cjs/chunks/{Button-KGA0e9-0.js → Button-DmWbooXb.js} +1 -1
- package/dist/cjs/chunks/{DropDown-CJH-Y6Z5.js → DropDown-Cy2o78yw.js} +3 -3
- package/dist/cjs/chunks/{FileList-CIRALfrW.js → FileList-DjTXjXnK.js} +1 -1
- package/dist/cjs/chunks/{ProgressIndicator-DETWiASA.js → ProgressIndicator-8QZwTSyY.js} +3 -2
- package/dist/cjs/chunks/{PromptInput-DUxwal3V.js → PromptInput-D1wP5-uN.js} +1 -1
- package/dist/cjs/chunks/{TextArea-mSespe9z.js → TextArea-CtJi771p.js} +2 -2
- package/dist/cjs/chunks/{TextField-Cz2lh-fP.js → TextField-B2u_CZKk.js} +2 -2
- package/dist/cjs/chunks/{UploadArea-CtvvqLU7.js → UploadArea-BS2BPuhZ.js} +1 -1
- package/dist/cjs/chunks/audioVisualizer-EIfIjWH7.js +60 -0
- package/dist/cjs/components/AudioBubble/index.js +10 -0
- package/dist/cjs/components/Button/index.js +2 -2
- package/dist/cjs/components/DropDown/index.js +1 -1
- package/dist/cjs/components/FileList/index.js +2 -2
- package/dist/cjs/components/Progress/index.js +1 -1
- package/dist/cjs/components/PromptInput/index.js +4 -4
- package/dist/cjs/components/TextArea/index.js +3 -3
- package/dist/cjs/components/Textfield/index.js +3 -3
- package/dist/cjs/components/UploadArea/index.js +3 -3
- package/dist/cjs/hooks/useAudioRecorder.js +70 -0
- package/dist/cjs/hooks/useMicrophone.js +142 -0
- package/dist/cjs/hooks.js +3 -2
- package/dist/cjs/index.js +14 -12
- package/dist/cjs/utils/index.js +3 -3
- package/dist/cjs/utils/objects/index.js +3 -3
- package/dist/esm/chunks/AudioBubble-DFh3Vxl6.mjs +62 -0
- package/dist/esm/chunks/{Avatar-CSLVUF_y.mjs → Avatar-C8uV7ROZ.mjs} +2 -2
- package/dist/esm/chunks/{AvatarGroup--ELW-bO1.mjs → AvatarGroup-Bt1Lkn5S.mjs} +2 -2
- package/dist/esm/chunks/{Badge-DyICxZP2.mjs → Badge-D-U1jomY.mjs} +1 -1
- package/dist/esm/chunks/{Button-Bp51g5jC.mjs → Button-sEYjFcR2.mjs} +5 -5
- package/dist/esm/chunks/{ButtonBar-BK-uB7oe.mjs → ButtonBar-DSR2lhhN.mjs} +3 -3
- package/dist/esm/chunks/{Camera-BYi_Aqbl.mjs → Camera-DSSiOeJd.mjs} +4 -4
- package/dist/esm/chunks/{CheckBox-BB5olQbT.mjs → CheckBox-B6zWSySW.mjs} +3 -3
- package/dist/esm/chunks/{Chip-CxqFCtT6.mjs → Chip-BBKJ6wG4.mjs} +3 -3
- package/dist/esm/chunks/{DivInput-DeSpC8Wm.mjs → DivInput-cIMIH07H.mjs} +2 -2
- package/dist/esm/chunks/{Dot-CLGwQu-i.mjs → Dot-Cj6gWj4_.mjs} +1 -1
- package/dist/esm/chunks/{DrggablePanel-BfBCRXa8.mjs → DrggablePanel-CQcIbxpX.mjs} +2 -2
- package/dist/esm/chunks/{DropDown-CK-sPjsQ.mjs → DropDown-DFUc_rjP.mjs} +6 -6
- package/dist/esm/chunks/{ErrorSummary-BNdjCQbn.mjs → ErrorSummary-Mz9siVxm.mjs} +1 -1
- package/dist/esm/chunks/{FileIcon-BXKnFJBn.mjs → FileIcon-DeW-ZBiv.mjs} +2 -2
- package/dist/esm/chunks/{FileList-CyUhkk-m.mjs → FileList-0Dzx15hl.mjs} +5 -5
- package/dist/esm/chunks/{Grouper-Daz1o_Ai.mjs → Grouper-B04WxD6K.mjs} +3 -3
- package/dist/esm/chunks/{Icon-CbwaBi0l.mjs → Icon-KDwlMXzH.mjs} +2 -2
- package/dist/esm/chunks/{IconButton-BKZD9jsp.mjs → IconButton-oAB8ZFTf.mjs} +4 -4
- package/dist/esm/chunks/{IndexedDB-CJgzPHPB.mjs → IndexedDB-Dk7a4fPS.mjs} +1 -1
- package/dist/esm/chunks/{Label-QTsUvGme.mjs → Label-BD7VlTDw.mjs} +2 -2
- package/dist/esm/chunks/{Overlay-TOzZXnwF.mjs → Overlay-3KkyDm1f.mjs} +1 -1
- package/dist/esm/chunks/{Pager-BYT7_mCb.mjs → Pager-DmiwYLl5.mjs} +2 -2
- package/dist/esm/chunks/{ProgressIndicator-Cg7CCrAE.mjs → ProgressIndicator-CxsZm_As.mjs} +5 -4
- package/dist/esm/chunks/{PromptInput-DJInpjRX.mjs → PromptInput-D4Q-DWjz.mjs} +3 -3
- package/dist/esm/chunks/{RadioButton-CYp8RkDK.mjs → RadioButton-B0jvM5VW.mjs} +3 -3
- package/dist/esm/chunks/{RadioButtonList-BSzV9Zz-.mjs → RadioButtonList-DBRAv87_.mjs} +3 -3
- package/dist/esm/chunks/{Slider-DL2iuNlh.mjs → Slider-CONGTXUE.mjs} +2 -2
- package/dist/esm/chunks/{Spacer-BlgEdKEM.mjs → Spacer-C5fcJYq-.mjs} +1 -1
- package/dist/esm/chunks/{Switch-BhCOo5Lu.mjs → Switch-CyoaJwSX.mjs} +1 -1
- package/dist/esm/chunks/{TabBar-Dd5-VZcG.mjs → TabBar-DmO1ixBz.mjs} +4 -4
- package/dist/esm/chunks/{TextArea-C_2D7sZV.mjs → TextArea-DaB8g-fZ.mjs} +3 -3
- package/dist/esm/chunks/{TextField-RG1AsLTh.mjs → TextField-BGeEJXUJ.mjs} +6 -6
- package/dist/esm/chunks/{Tip-BnKB9qMi.mjs → Tip-DrQvxDsH.mjs} +2 -2
- package/dist/esm/chunks/{Toast-BfuKRAns.mjs → Toast-C5XSDgno.mjs} +3 -3
- package/dist/esm/chunks/{UploadArea-ByvnUxhr.mjs → UploadArea-Gpq-MhqB.mjs} +4 -4
- package/dist/esm/chunks/{WSConnection-D9mpsVdc.mjs → WSConnection-DV7k84B4.mjs} +1 -1
- package/dist/esm/chunks/{_types-CPrEyJX9.mjs → _types-DOQAaLqq.mjs} +1 -1
- package/dist/esm/chunks/audioVisualizer-ZgT77nUw.mjs +60 -0
- package/dist/esm/chunks/{localDBStore-B4jkR5Jx.mjs → localDBStore-Dnpo5nSv.mjs} +2 -2
- package/dist/esm/chunks/{misc-N8KLjOXc.mjs → misc-BeEWwOaJ.mjs} +1 -1
- package/dist/esm/chunks/{sseStore-2JIpEKfz.mjs → sseStore-DjrfpNAS.mjs} +1 -1
- package/dist/esm/chunks/{tslib.es6-c-7TIv71.mjs → tslib.es6-C-olHjXV.mjs} +1 -1
- package/dist/esm/chunks/{uploads-worker-Dv-4zGnC.mjs → uploads-worker-7X9EwX9N.mjs} +1 -1
- package/dist/esm/chunks/{uploadsStore-D69fEXMY.mjs → uploadsStore-B7VECR5Q.mjs} +1 -1
- package/dist/esm/chunks/{windowStore-BOTh1g37.mjs → windowStore-CAzx2-QV.mjs} +1 -1
- package/dist/esm/components/AudioBubble/index.mjs +31 -0
- package/dist/esm/components/Avatar/index.mjs +3 -3
- package/dist/esm/components/AvatarGroup/index.mjs +4 -4
- package/dist/esm/components/Badge/index.mjs +2 -2
- package/dist/esm/components/Button/index.mjs +7 -7
- package/dist/esm/components/ButtonBar/index.mjs +4 -4
- package/dist/esm/components/Camera/index.mjs +5 -5
- package/dist/esm/components/CheckBox/index.mjs +4 -4
- package/dist/esm/components/Chip/index.mjs +4 -4
- package/dist/esm/components/DivInput/index.mjs +3 -3
- package/dist/esm/components/Dot/index.mjs +2 -2
- package/dist/esm/components/DraggablePanel/index.mjs +3 -3
- package/dist/esm/components/DropDown/index.mjs +4 -4
- package/dist/esm/components/ErrorSummary/index.mjs +2 -2
- package/dist/esm/components/FileIcon/index.mjs +3 -3
- package/dist/esm/components/FileList/index.mjs +6 -6
- package/dist/esm/components/FlexDiv/index.mjs +2 -2
- package/dist/esm/components/Grouper/index.mjs +5 -5
- package/dist/esm/components/Icon/index.mjs +3 -3
- package/dist/esm/components/IconButton/index.mjs +6 -6
- package/dist/esm/components/Label/index.mjs +3 -3
- package/dist/esm/components/Overlay/index.mjs +2 -2
- package/dist/esm/components/Pager/index.mjs +3 -3
- package/dist/esm/components/Progress/index.mjs +4 -4
- package/dist/esm/components/PromptInput/index.mjs +10 -10
- package/dist/esm/components/RadioButton/index.mjs +4 -4
- package/dist/esm/components/RadioButtonList/index.mjs +5 -5
- package/dist/esm/components/Slider/index.mjs +3 -3
- package/dist/esm/components/Spacer/index.mjs +2 -2
- package/dist/esm/components/Switch/index.mjs +2 -2
- package/dist/esm/components/TabBar/index.mjs +7 -7
- package/dist/esm/components/TextArea/index.mjs +8 -8
- package/dist/esm/components/Textfield/index.mjs +9 -9
- package/dist/esm/components/Tip/index.mjs +3 -3
- package/dist/esm/components/Toast/index.mjs +4 -4
- package/dist/esm/components/UploadArea/index.mjs +7 -7
- package/dist/esm/hooks/useAudioRecorder.mjs +74 -0
- package/dist/esm/hooks/useMdStreamBuffer.mjs +1 -1
- package/dist/esm/hooks/useMicrophone.mjs +144 -0
- package/dist/esm/hooks/useTrackRenders.mjs +2 -2
- package/dist/esm/hooks.mjs +5 -1
- package/dist/esm/index.mjs +47 -39
- package/dist/esm/stores/LocalDB.mjs +3 -3
- package/dist/esm/stores/SSE.mjs +2 -2
- package/dist/esm/stores/WS.mjs +2 -2
- package/dist/esm/stores/uploads.mjs +3 -3
- package/dist/esm/stores/window.mjs +2 -2
- package/dist/esm/stores.mjs +7 -7
- package/dist/esm/utils/index.mjs +6 -4
- package/dist/esm/utils/objects/index.mjs +5 -3
- package/dist/esm/workers/uploads/uploads.mjs +2 -2
- package/dist/types/components/AudioBubble/AudioBubble.d.ts +3 -0
- package/dist/types/components/AudioBubble/_types.d.ts +18 -0
- package/dist/types/components/AudioBubble/index.d.ts +2 -0
- package/dist/types/components/DropDown/_types.d.ts +1 -0
- package/dist/types/hooks/index.d.ts +3 -0
- package/dist/types/hooks/useAudioRecorder/useAudioRecorder.d.ts +14 -0
- package/dist/types/hooks/useMicrophone/useMicrophone.d.ts +23 -0
- package/dist/types/index.d.ts +3 -1
- package/dist/types/utils/functions/files.d.ts +1 -1
- package/dist/types/utils/index.d.ts +2 -2
- package/dist/types/utils/objects/WebRTCConnection/WebRTCConnection.d.ts +86 -0
- package/dist/types/utils/objects/WebRTCConnection/_types.d.ts +11 -0
- package/dist/types/utils/objects/audioVisualizer/audioVisualizer.d.ts +40 -0
- package/dist/types/utils/objects/index.d.ts +2 -0
- package/package.json +1 -1
package/dist/esm/utils/index.mjs
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
export { c as copyToClipboard, h as hexToRgb } from "../chunks/misc-
|
|
1
|
+
export { c as copyToClipboard, h as hexToRgb } from "../chunks/misc-BeEWwOaJ.mjs";
|
|
2
2
|
|
|
3
3
|
export { d as debounce } from "../chunks/debounce-Bst1jxMS.mjs";
|
|
4
4
|
|
|
5
5
|
export { a as addOpacity, t as tintFromColor } from "../chunks/colors-FQ0uNQcW.mjs";
|
|
6
6
|
|
|
7
|
-
export { I as IndexedDB } from "../chunks/IndexedDB-
|
|
7
|
+
export { I as IndexedDB } from "../chunks/IndexedDB-Dk7a4fPS.mjs";
|
|
8
|
+
|
|
9
|
+
export { A as AudioVisualizer } from "../chunks/audioVisualizer-ZgT77nUw.mjs";
|
|
8
10
|
|
|
9
11
|
export { M as MdBuffer } from "../chunks/MdStreamBuffer-DNXE4XbN.mjs";
|
|
10
12
|
|
|
11
13
|
export { S as SSEConnection } from "../chunks/SSEConnection-DcA3wFsO.mjs";
|
|
12
14
|
|
|
13
|
-
export { W as WSConnection } from "../chunks/WSConnection-
|
|
15
|
+
export { W as WSConnection } from "../chunks/WSConnection-DV7k84B4.mjs";
|
|
14
16
|
|
|
15
|
-
import "../chunks/tslib.es6-
|
|
17
|
+
import "../chunks/tslib.es6-C-olHjXV.mjs";
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
export { I as IndexedDB } from "../../chunks/IndexedDB-
|
|
1
|
+
export { I as IndexedDB } from "../../chunks/IndexedDB-Dk7a4fPS.mjs";
|
|
2
|
+
|
|
3
|
+
export { A as AudioVisualizer } from "../../chunks/audioVisualizer-ZgT77nUw.mjs";
|
|
2
4
|
|
|
3
5
|
export { M as MdBuffer } from "../../chunks/MdStreamBuffer-DNXE4XbN.mjs";
|
|
4
6
|
|
|
5
7
|
export { S as SSEConnection } from "../../chunks/SSEConnection-DcA3wFsO.mjs";
|
|
6
8
|
|
|
7
|
-
export { W as WSConnection } from "../../chunks/WSConnection-
|
|
9
|
+
export { W as WSConnection } from "../../chunks/WSConnection-DV7k84B4.mjs";
|
|
8
10
|
|
|
9
|
-
import "../../chunks/tslib.es6-
|
|
11
|
+
import "../../chunks/tslib.es6-C-olHjXV.mjs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as registerUploadsWorker } from "../../chunks/uploads-worker-
|
|
1
|
+
import { r as registerUploadsWorker } from "../../chunks/uploads-worker-7X9EwX9N.mjs";
|
|
2
2
|
|
|
3
|
-
import "../../chunks/tslib.es6-
|
|
3
|
+
import "../../chunks/tslib.es6-C-olHjXV.mjs";
|
|
4
4
|
|
|
5
5
|
registerUploadsWorker();
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
export type AudioBubbleBaseProps = {
|
|
3
|
+
audioStream?: MediaStream | MediaStreamTrack | null;
|
|
4
|
+
playing?: boolean;
|
|
5
|
+
size?: number;
|
|
6
|
+
backgroundColor?: string;
|
|
7
|
+
glow?: boolean;
|
|
8
|
+
glowColor?: string;
|
|
9
|
+
glowSize?: number;
|
|
10
|
+
glowOffset?: number;
|
|
11
|
+
minScale?: number;
|
|
12
|
+
maxScale?: number;
|
|
13
|
+
intensity?: number;
|
|
14
|
+
peakIntensity?: number;
|
|
15
|
+
risePerSeconds?: number;
|
|
16
|
+
ReleasePerSeconds?: number;
|
|
17
|
+
};
|
|
18
|
+
export type AudioBubbleProps = Omit<React.HTMLAttributes<HTMLDivElement>, keyof AudioBubbleBaseProps> & AudioBubbleBaseProps;
|
|
@@ -35,6 +35,7 @@ type DropDownBaseProps<T = string> = {
|
|
|
35
35
|
gap?: number;
|
|
36
36
|
size?: 'xs' | 's' | 'm' | 'l';
|
|
37
37
|
onChange?: (index: number, option: DropDownOption<T>) => void;
|
|
38
|
+
onOption?: (option: DropDownOption<T>) => void;
|
|
38
39
|
};
|
|
39
40
|
export type DropDownProps<T = string> = Omit<React.HTMLAttributes<HTMLDivElement>, keyof DropDownBaseProps<T>> & DropDownBaseProps<T>;
|
|
40
41
|
export {};
|
|
@@ -6,5 +6,8 @@ export { type KeyboardShortcut, type KeyboardShortcuts, useKeyboardShortcuts, }
|
|
|
6
6
|
export { useLastUpdated } from './useLastUpdated/useLastUpdated';
|
|
7
7
|
export { useLocalStore } from './useLocalStore/useLocalStore';
|
|
8
8
|
export { useMDStreamBuffer } from './useMdStreamBuffer/useMdStreamBuffer';
|
|
9
|
+
export { useMicrophone } from './useMicrophone/useMicrophone';
|
|
10
|
+
export type { MicOption, UseMicrophoneReturn, } from './useMicrophone/useMicrophone';
|
|
11
|
+
export { useAudioRecorder } from './useAudioRecorder/useAudioRecorder';
|
|
9
12
|
export { useWindow, FormFactor, type BreakPoints, type WindowGeolocation, type WindowGeolocationError, } from './useWindow/useWindow';
|
|
10
13
|
export { useObserveResize } from './useObserveResize/useObserveResize';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { RefObject } from 'react';
|
|
2
|
+
type UseStreamToMp3Return = {
|
|
3
|
+
audioBlob: RefObject<Blob | null>;
|
|
4
|
+
error: Error | null;
|
|
5
|
+
isRecording: boolean;
|
|
6
|
+
recordingSizeMb: number;
|
|
7
|
+
mimeType: string | null;
|
|
8
|
+
resetRecording: () => void;
|
|
9
|
+
startRecording: () => void;
|
|
10
|
+
stopRecording: () => Promise<Blob | null>;
|
|
11
|
+
};
|
|
12
|
+
type AudioRecorderSource = MediaStream | MediaStreamTrack | RefObject<MediaStream | MediaStreamTrack | null> | null | undefined;
|
|
13
|
+
export declare function useAudioRecorder(audioStream: AudioRecorderSource): UseStreamToMp3Return;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { RefObject } from 'react';
|
|
2
|
+
import type { DropDownOption } from '../../components/DropDown';
|
|
3
|
+
export type MicOption = {
|
|
4
|
+
id: string;
|
|
5
|
+
};
|
|
6
|
+
export type UseMicrophoneReturn = {
|
|
7
|
+
micStream: RefObject<MediaStream | null>;
|
|
8
|
+
micTrack: RefObject<MediaStreamTrack | null>;
|
|
9
|
+
muted: boolean;
|
|
10
|
+
isSupported: boolean;
|
|
11
|
+
isRequesting: boolean;
|
|
12
|
+
error: Error | null;
|
|
13
|
+
microphones: MediaDeviceInfo[];
|
|
14
|
+
micOptions: DropDownOption<MicOption>[];
|
|
15
|
+
requestMicrophone: () => Promise<MediaStream | null>;
|
|
16
|
+
stopMicrophone: () => void;
|
|
17
|
+
muteMic: () => boolean;
|
|
18
|
+
unmuteMic: () => boolean;
|
|
19
|
+
toggleMute: () => void;
|
|
20
|
+
refreshMicrophones: () => Promise<MediaDeviceInfo[]>;
|
|
21
|
+
setMicrophone: (deviceId: string | DropDownOption<MicOption>) => Promise<void>;
|
|
22
|
+
};
|
|
23
|
+
export declare function useMicrophone(startMuted?: boolean, microphoneDeviceId?: string): UseMicrophoneReturn;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -2,7 +2,9 @@ export type { ToolTip, ToolTipInfo } from './components/sharedTypes';
|
|
|
2
2
|
export { ToolTipType } from './components/sharedTypes';
|
|
3
3
|
export { light, dark, lightTheme, darkTheme, motion, elevations, Elevation, } from './theme';
|
|
4
4
|
export type { SliceTheme, Colors, Type, Corners, Elevations, } from './theme';
|
|
5
|
-
export { type KeyboardShortcut, type KeyboardShortcuts, type BreakPoints, type WindowGeolocation, type WindowGeolocationError, useKeyboardShortcuts, useTheme, useObserveTheme, useToolTip, useLastUpdated, useLocalStore, useMDStreamBuffer, useWindow, useDoubleClick, useObserveResize, } from './hooks';
|
|
5
|
+
export { type KeyboardShortcut, type KeyboardShortcuts, type BreakPoints, type WindowGeolocation, type WindowGeolocationError, type MicOption, type UseMicrophoneReturn, useKeyboardShortcuts, useTheme, useObserveTheme, useToolTip, useLastUpdated, useLocalStore, useMDStreamBuffer, useAudioRecorder, useMicrophone, useWindow, useDoubleClick, useObserveResize, } from './hooks';
|
|
6
|
+
export { AudioBubble } from './components/AudioBubble/index';
|
|
7
|
+
export type { AudioBubbleProps } from './components/AudioBubble/index';
|
|
6
8
|
export { Avatar } from './components/Avatar/index';
|
|
7
9
|
export type { AvatarProps } from './components/Avatar/index';
|
|
8
10
|
export { AvatarGroup } from './components/AvatarGroup';
|
|
@@ -8,7 +8,7 @@ export declare function nameAndExtension(fileName: string): {
|
|
|
8
8
|
/**
|
|
9
9
|
* Map a file extension to the corresponding file icon name.
|
|
10
10
|
*/
|
|
11
|
-
export declare function fileIconName(extension: string): "other" | "
|
|
11
|
+
export declare function fileIconName(extension: string): "other" | "video" | "text" | "sheet" | "image" | "audio" | "md" | "code" | "preso" | "pdf" | "clipboard";
|
|
12
12
|
/**
|
|
13
13
|
* Create a clipboard-text file with a guaranteed `.clipboard` extension.
|
|
14
14
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { copyToClipboard, hexToRgb } from './functions/misc';
|
|
2
2
|
export { debounce } from './functions/debounce';
|
|
3
3
|
export * from './functions/colors';
|
|
4
|
-
export { IndexedDB, MdBuffer, SSEConnection, WSConnection, } from './objects';
|
|
5
|
-
export type { IndexedDBOptions, MarkdownAutoCloseRule, MarkdownStreamBufferOptions, MarkdownStreamBufferSnapshot, SSECustomEvent, SSEConnectionCloseOption, SSEConnectionOptions, SSEEventMap, SSEUnifiedBuiltInMessage, SSEUnifiedCustomMessage, SSEUnifiedMessage, UnifiedMessageEvent, WSConnectionOptions, } from './objects';
|
|
4
|
+
export { AudioVisualizer, IndexedDB, MdBuffer, SSEConnection, WSConnection, } from './objects';
|
|
5
|
+
export type { AudioVisualizerOptions, AudioVisualizerSource, IndexedDBOptions, MarkdownAutoCloseRule, MarkdownStreamBufferOptions, MarkdownStreamBufferSnapshot, SSECustomEvent, SSEConnectionCloseOption, SSEConnectionOptions, SSEEventMap, SSEUnifiedBuiltInMessage, SSEUnifiedCustomMessage, SSEUnifiedMessage, UnifiedMessageEvent, WSConnectionOptions, } from './objects';
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { WebRTCConnectionOptions } from './_types';
|
|
2
|
+
export declare class WebRTCConnection {
|
|
3
|
+
private readonly peerConnection;
|
|
4
|
+
private readonly RTCSenderAudioTrack?;
|
|
5
|
+
private readonly RTCSenderVideoTrack?;
|
|
6
|
+
private RTCScreenShareTrack;
|
|
7
|
+
private RTCScreenShareSender;
|
|
8
|
+
private readonly RTCReceiverAudioStream;
|
|
9
|
+
private readonly RTCReceiverVideoTracks;
|
|
10
|
+
private readonly RTCReceiverAudioTracks;
|
|
11
|
+
private readonly RTCDataChannels;
|
|
12
|
+
private readonly connectionUrl;
|
|
13
|
+
private connectionOffer;
|
|
14
|
+
private audioElement;
|
|
15
|
+
private readonly autoPlayAudio;
|
|
16
|
+
private readonly onRemoteAudioStream?;
|
|
17
|
+
private readonly onRemoteVideoStream?;
|
|
18
|
+
private readonly onDataChannelEvent?;
|
|
19
|
+
private iceTimer?;
|
|
20
|
+
private offerOptions?;
|
|
21
|
+
private bearerToken?;
|
|
22
|
+
/**
|
|
23
|
+
* Create the base instance
|
|
24
|
+
*/
|
|
25
|
+
constructor(rtcConnectionInfo: WebRTCConnectionOptions);
|
|
26
|
+
/**
|
|
27
|
+
* Initialize the RTC connection
|
|
28
|
+
*/
|
|
29
|
+
initialize(offerOptions?: RTCOfferOptions, bearerToken?: string): Promise<void>;
|
|
30
|
+
/**
|
|
31
|
+
* Start an optional screen share stream and renegotiate if already connected
|
|
32
|
+
*/
|
|
33
|
+
startScreenShare(): Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* Stop the optional screen share stream and renegotiate if already connected
|
|
36
|
+
*/
|
|
37
|
+
stopScreenShare(stopTrack?: boolean): Promise<void>;
|
|
38
|
+
/**
|
|
39
|
+
* Create an offer, wait for ICE gathering, POST SDP, and apply the answer
|
|
40
|
+
*/
|
|
41
|
+
private negotiate;
|
|
42
|
+
/**
|
|
43
|
+
* Send a JSON-serializable payload over a named data channel
|
|
44
|
+
*/
|
|
45
|
+
sendMessage(channelName: string, data: string | number | boolean | object | null): void;
|
|
46
|
+
/**
|
|
47
|
+
* Mute or unmute all incoming audio playback
|
|
48
|
+
*/
|
|
49
|
+
muteAllAudio(muted: boolean): void;
|
|
50
|
+
/**
|
|
51
|
+
* Mute or unmute a specific incoming audio track
|
|
52
|
+
*/
|
|
53
|
+
muteAudioTrack(trackId: string, muted: boolean): void;
|
|
54
|
+
/**
|
|
55
|
+
* Set the playback volume for the incoming audio element
|
|
56
|
+
*/
|
|
57
|
+
setAudioVolume(volume: number): void;
|
|
58
|
+
/**
|
|
59
|
+
* Create an audio source node from the unified incoming audio stream
|
|
60
|
+
*/
|
|
61
|
+
createIncomingAudioSource(audioContext: AudioContext): MediaStreamAudioSourceNode;
|
|
62
|
+
/**
|
|
63
|
+
* Handle track events adding them to the unified audio and video streams
|
|
64
|
+
*/
|
|
65
|
+
private onTrack;
|
|
66
|
+
/**
|
|
67
|
+
* Create a local audio element and set its source to the rtc incoming media stream
|
|
68
|
+
*/
|
|
69
|
+
private setupIncomingAudioStream;
|
|
70
|
+
/**
|
|
71
|
+
* Set up a local stream with mic and video tracks and add to peer connection
|
|
72
|
+
*/
|
|
73
|
+
private setupOutgoingMediaStream;
|
|
74
|
+
/**
|
|
75
|
+
* Setup data channels
|
|
76
|
+
*/
|
|
77
|
+
private setupDataChannels;
|
|
78
|
+
/**
|
|
79
|
+
* Add listeners for data events and push through callback
|
|
80
|
+
*/
|
|
81
|
+
private setupDataChannelEventListeners;
|
|
82
|
+
/**
|
|
83
|
+
* Wait for the ICE gathering to be complete
|
|
84
|
+
*/
|
|
85
|
+
private waitForIceGathering;
|
|
86
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface WebRTCConnectionOptions {
|
|
2
|
+
connectionUrl?: string;
|
|
3
|
+
audioElement?: HTMLAudioElement;
|
|
4
|
+
autoPlayAudio?: boolean;
|
|
5
|
+
dataChannels?: string | string[];
|
|
6
|
+
micMediaTrack: MediaStreamTrack;
|
|
7
|
+
videoMediaTrack?: MediaStreamTrack;
|
|
8
|
+
onRemoteVideoStream?: (streams: Map<string, MediaStream>) => void;
|
|
9
|
+
onRemoteAudioStream?: (streams: Map<string, MediaStream>) => void;
|
|
10
|
+
onDataChannelEvent?: (channel: string, eventType: 'message' | 'open' | 'close' | 'error', eventData: MessageEvent | Event | RTCErrorEvent) => void;
|
|
11
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
type AudioVisualizerSource = MediaStream | MediaStreamTrack;
|
|
2
|
+
type AudioVisualizerOptions = {
|
|
3
|
+
fftSize?: number;
|
|
4
|
+
intensityMultiplier?: number;
|
|
5
|
+
maxScale?: number;
|
|
6
|
+
minScale?: number;
|
|
7
|
+
onUpdate?: (state: {
|
|
8
|
+
intensity: number;
|
|
9
|
+
scale: number;
|
|
10
|
+
}) => void;
|
|
11
|
+
peakIntensity?: number;
|
|
12
|
+
releasePerSecond?: number;
|
|
13
|
+
risePerSecond?: number;
|
|
14
|
+
};
|
|
15
|
+
export declare class AudioVisualizer {
|
|
16
|
+
private readonly fftSize;
|
|
17
|
+
private readonly intensityMultiplier;
|
|
18
|
+
private readonly maxScale;
|
|
19
|
+
private readonly minScale;
|
|
20
|
+
private readonly onUpdate?;
|
|
21
|
+
private readonly peakIntensity;
|
|
22
|
+
private readonly releasePerSecond;
|
|
23
|
+
private readonly risePerSecond;
|
|
24
|
+
private readonly source;
|
|
25
|
+
private analyser;
|
|
26
|
+
private animationFrameId;
|
|
27
|
+
private audioContext;
|
|
28
|
+
private currentIntensity;
|
|
29
|
+
private lastFrameTime;
|
|
30
|
+
private sourceNode;
|
|
31
|
+
private timeDomainData;
|
|
32
|
+
constructor(source: AudioVisualizerSource, options?: AudioVisualizerOptions);
|
|
33
|
+
start(): void;
|
|
34
|
+
stop(): void;
|
|
35
|
+
dispose(): void;
|
|
36
|
+
getIntensity(): number;
|
|
37
|
+
getScale(): number;
|
|
38
|
+
private readonly onFrame;
|
|
39
|
+
}
|
|
40
|
+
export type { AudioVisualizerOptions, AudioVisualizerSource };
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { IndexedDB } from './IndexedDB/IndexedDB';
|
|
2
2
|
export type { IndexedDBOptions } from './IndexedDB/IndexedDB';
|
|
3
|
+
export { AudioVisualizer } from './audioVisualizer/audioVisualizer';
|
|
4
|
+
export type { AudioVisualizerOptions, AudioVisualizerSource, } from './audioVisualizer/audioVisualizer';
|
|
3
5
|
export { MdBuffer } from './MDStreamBuffer/MdStreamBuffer';
|
|
4
6
|
export type { MarkdownAutoCloseRule, MarkdownStreamBufferOptions, MarkdownStreamBufferSnapshot, } from './MDStreamBuffer/_types';
|
|
5
7
|
export { SSEConnection } from './SSEConnection/SSEConnection';
|