@stream-io/video-react-bindings 1.7.16 → 1.8.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/CHANGELOG.md +16 -0
- package/dist/index.cjs.js +15 -7
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +15 -7
- package/dist/index.es.js.map +1 -1
- package/dist/src/hooks/callStateHooks.d.ts +27 -3
- package/dist/src/hooks/index.d.ts +1 -0
- package/package.json +3 -3
- package/src/hooks/callStateHooks.ts +28 -3
- package/src/hooks/index.ts +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [1.8.1](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-bindings-1.8.0...@stream-io/video-react-bindings-1.8.1) (2025-09-11)
|
|
6
|
+
|
|
7
|
+
### Dependency Updates
|
|
8
|
+
|
|
9
|
+
- `@stream-io/video-client` updated to version `1.30.0`
|
|
10
|
+
|
|
11
|
+
## [1.8.0](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-bindings-1.7.16...@stream-io/video-react-bindings-1.8.0) (2025-09-09)
|
|
12
|
+
|
|
13
|
+
### Dependency Updates
|
|
14
|
+
|
|
15
|
+
- `@stream-io/video-client` updated to version `1.29.0`
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
- opt-out from optimistic updates ([#1904](https://github.com/GetStream/stream-video-js/issues/1904)) ([45dba34](https://github.com/GetStream/stream-video-js/commit/45dba34d38dc64f456e37b593e38e420426529f5))
|
|
20
|
+
|
|
5
21
|
## [1.7.16](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-bindings-1.7.15...@stream-io/video-react-bindings-1.7.16) (2025-08-22)
|
|
6
22
|
|
|
7
23
|
### Dependency Updates
|
package/dist/index.cjs.js
CHANGED
|
@@ -414,7 +414,7 @@ const useHasPermissions = (...permissions) => {
|
|
|
414
414
|
/**
|
|
415
415
|
* Returns the camera state of the current call.
|
|
416
416
|
*/
|
|
417
|
-
const useCameraState = () => {
|
|
417
|
+
const useCameraState = ({ optimisticUpdates = true, } = {}) => {
|
|
418
418
|
const call = useCall();
|
|
419
419
|
const { camera } = call;
|
|
420
420
|
const { state } = camera;
|
|
@@ -434,13 +434,13 @@ const useCameraState = () => {
|
|
|
434
434
|
hasBrowserPermission,
|
|
435
435
|
isPromptingPermission,
|
|
436
436
|
selectedDevice,
|
|
437
|
-
...getComputedStatus(useObservableValue(state.status$), useObservableValue(state.optimisticStatus$)),
|
|
437
|
+
...getComputedStatus(useObservableValue(state.status$), useObservableValue(state.optimisticStatus$), { optimisticUpdates }),
|
|
438
438
|
};
|
|
439
439
|
};
|
|
440
440
|
/**
|
|
441
441
|
* Returns the microphone state of the current call.
|
|
442
442
|
*/
|
|
443
|
-
const useMicrophoneState = () => {
|
|
443
|
+
const useMicrophoneState = ({ optimisticUpdates = true, } = {}) => {
|
|
444
444
|
const call = useCall();
|
|
445
445
|
const { microphone } = call;
|
|
446
446
|
const { state } = microphone;
|
|
@@ -460,7 +460,7 @@ const useMicrophoneState = () => {
|
|
|
460
460
|
hasBrowserPermission,
|
|
461
461
|
isPromptingPermission,
|
|
462
462
|
isSpeakingWhileMuted,
|
|
463
|
-
...getComputedStatus(useObservableValue(state.status$), useObservableValue(state.optimisticStatus$)),
|
|
463
|
+
...getComputedStatus(useObservableValue(state.status$), useObservableValue(state.optimisticStatus$), { optimisticUpdates }),
|
|
464
464
|
};
|
|
465
465
|
};
|
|
466
466
|
/**
|
|
@@ -488,13 +488,13 @@ const useSpeakerState = () => {
|
|
|
488
488
|
/**
|
|
489
489
|
* Returns the Screen Share state of the current call.
|
|
490
490
|
*/
|
|
491
|
-
const useScreenShareState = () => {
|
|
491
|
+
const useScreenShareState = ({ optimisticUpdates = true, } = {}) => {
|
|
492
492
|
const call = useCall();
|
|
493
493
|
const { screenShare } = call;
|
|
494
494
|
return {
|
|
495
495
|
screenShare,
|
|
496
496
|
mediaStream: useObservableValue(screenShare.state.mediaStream$),
|
|
497
|
-
...getComputedStatus(useObservableValue(screenShare.state.status$), useObservableValue(screenShare.state.optimisticStatus$)),
|
|
497
|
+
...getComputedStatus(useObservableValue(screenShare.state.status$), useObservableValue(screenShare.state.optimisticStatus$), { optimisticUpdates }),
|
|
498
498
|
};
|
|
499
499
|
};
|
|
500
500
|
/**
|
|
@@ -520,7 +520,7 @@ const useIsCallCaptioningInProgress = () => {
|
|
|
520
520
|
const { captioning$ } = useCallState();
|
|
521
521
|
return useObservableValue(captioning$);
|
|
522
522
|
};
|
|
523
|
-
function getComputedStatus(status, pendingStatus) {
|
|
523
|
+
function getComputedStatus(status, pendingStatus, options) {
|
|
524
524
|
const optimisticStatus = pendingStatus ?? status;
|
|
525
525
|
return {
|
|
526
526
|
status,
|
|
@@ -529,6 +529,14 @@ function getComputedStatus(status, pendingStatus) {
|
|
|
529
529
|
isMute: status !== 'enabled',
|
|
530
530
|
optimisticIsMute: optimisticStatus !== 'enabled',
|
|
531
531
|
isTogglePending: optimisticStatus !== status,
|
|
532
|
+
/**
|
|
533
|
+
* If optimistic updates are enabled (`options.optimisticUpdates`), we
|
|
534
|
+
* consider the optimistic status to determine whether the device is muted or not.
|
|
535
|
+
* Otherwise, we rely on the actual status.
|
|
536
|
+
*/
|
|
537
|
+
optionsAwareIsMute: options.optimisticUpdates
|
|
538
|
+
? optimisticStatus !== 'enabled'
|
|
539
|
+
: status !== 'enabled',
|
|
532
540
|
};
|
|
533
541
|
}
|
|
534
542
|
function useLazyDeviceList(manager) {
|
package/dist/index.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../../src/contexts/StreamCallContext.tsx","../../src/i18n/StreamI18n.ts","../../src/contexts/StreamI18nContext.tsx","../../src/contexts/StreamVideoContext.tsx","../../src/helpers/platforms.ts","../../src/hooks/useObservableValue.ts","../../src/hooks/callStateHooks.ts","../../src/hooks/store.ts","../../src/hooks/callUtilHooks.ts","../../src/hooks/index.ts","../../src/wrappers/Restricted.tsx"],"sourcesContent":["import { createContext, PropsWithChildren, useContext } from 'react';\nimport { Call } from '@stream-io/video-client';\n\nconst StreamCallContext = createContext<Call | undefined>(undefined);\n\n/**\n * The props for the StreamCallProvider component.\n */\nexport interface StreamCallProviderProps {\n /**\n * The call instance to provide to the component tree.\n */\n call?: Call;\n}\n\n/**\n * A provider for the call object.\n */\nexport const StreamCallProvider = (\n props: PropsWithChildren<StreamCallProviderProps>,\n) => {\n const { call, children } = props;\n return (\n <StreamCallContext.Provider value={call}>\n {children}\n </StreamCallContext.Provider>\n );\n};\n\n/**\n * A hook to get the call object from the closest provider.\n */\nexport const useCall = () => {\n return useContext(StreamCallContext);\n};\n","import i18next from 'i18next';\nimport {\n TranslationLanguage,\n TranslationsMap,\n TranslationsRegistry,\n TranslatorFunction,\n} from './types';\n\nconst mapToRegistry = (translationsMap: TranslationsMap, namespace: string) =>\n Object.entries(translationsMap).reduce((acc, [lng, translations]) => {\n acc[lng] = { [namespace]: translations };\n return acc;\n }, {} as TranslationsRegistry);\n\nexport const defaultTranslationFunction = (key: string) => key;\n\nexport type StreamI18nConstructor = {\n /** Language into which the provided strings are translated */\n currentLanguage?: TranslationLanguage;\n /** Fallback language which will be used if no translation is found for current language */\n fallbackLanguage?: TranslationLanguage;\n /** Logs info level to console output. Helps find issues with loading not working. */\n debug?: boolean;\n /** Custom translations that will be merged with the defaults provided by the library. */\n translationsOverrides?: TranslationsMap;\n};\n\nexport class StreamI18n {\n /** Exposed i18n instance from the i18next library */\n i18nInstance;\n /** Translator function that converts the provided string into its equivalent in the current language. */\n t: TranslatorFunction = defaultTranslationFunction;\n\n constructor({\n debug = false,\n currentLanguage = 'en',\n fallbackLanguage,\n translationsOverrides = { en: {} },\n }: StreamI18nConstructor = {}) {\n const ns = 'stream-video';\n this.i18nInstance = i18next.createInstance({\n debug,\n defaultNS: ns,\n fallbackLng: fallbackLanguage,\n interpolation: { escapeValue: false },\n keySeparator: false,\n lng: currentLanguage,\n nsSeparator: false,\n parseMissingKeyHandler: defaultTranslationFunction,\n resources: mapToRegistry(translationsOverrides, ns),\n });\n }\n\n get currentLanguage() {\n return this.i18nInstance.language;\n }\n\n get isInitialized() {\n return this.i18nInstance.isInitialized;\n }\n\n init = async () => {\n this.t = await this.i18nInstance.init();\n return this.t;\n };\n\n changeLanguage = async (language?: TranslationLanguage) => {\n this.t = await this.i18nInstance.changeLanguage(language);\n return this.t;\n };\n}\n","import {\n createContext,\n PropsWithChildren,\n useContext,\n useEffect,\n useMemo,\n useState,\n} from 'react';\nimport {\n defaultTranslationFunction,\n StreamI18n,\n TranslationLanguage,\n TranslationsMap,\n} from '../i18n';\n\ntype StreamI18nContextValue = {\n t: StreamI18n['t'];\n i18n?: StreamI18n;\n};\n\nconst StreamI18nContext = createContext<StreamI18nContextValue>({\n t: defaultTranslationFunction,\n});\n\ntype CreateI18nParams = {\n i18nInstance?: StreamI18n;\n language?: TranslationLanguage;\n fallbackLanguage?: TranslationLanguage;\n translationsOverrides?: TranslationsMap;\n};\n\nexport type StreamI18nProviderProps = CreateI18nParams;\n\nexport const StreamI18nProvider = ({\n children,\n ...createI18nParams\n}: PropsWithChildren<StreamI18nProviderProps>) => {\n const api = useCreateI18n(createI18nParams);\n return (\n <StreamI18nContext.Provider value={api}>\n {children}\n </StreamI18nContext.Provider>\n );\n};\n\nconst useCreateI18n = ({\n i18nInstance,\n language,\n fallbackLanguage,\n translationsOverrides,\n}: CreateI18nParams) => {\n const [i18n] = useState(\n () =>\n i18nInstance ||\n new StreamI18n({\n currentLanguage: language,\n fallbackLanguage,\n translationsOverrides,\n }),\n );\n const [t, setTranslationFn] = useState<StreamI18n['t']>(() => i18n.t);\n useEffect(() => {\n if (!i18n.isInitialized) {\n i18n.init().then(() => setTranslationFn(() => i18n.t));\n } else if (i18n.currentLanguage !== language) {\n i18n.changeLanguage(language).then(() => setTranslationFn(() => i18n.t));\n }\n }, [i18n, language]);\n\n return useMemo(() => ({ i18n, t }), [i18n, t]);\n};\n\n/**\n * A hook to get the i18n instance and translation function from the closest provider.\n *\n * Example usage:\n * const { t, i18n } = useI18n();\n * const message = t('hello_world');\n * console.log(message);\n */\nexport const useI18n = () => useContext(StreamI18nContext);\n","import { createContext, PropsWithChildren, useContext } from 'react';\nimport { StreamVideoClient } from '@stream-io/video-client';\nimport {\n StreamI18nProvider,\n StreamI18nProviderProps,\n} from './StreamI18nContext';\n\nconst StreamVideoContext = createContext<StreamVideoClient | undefined>(\n undefined,\n);\n\n/**\n * The props for the StreamVideoProvider component.\n */\nexport type StreamVideoProps = StreamI18nProviderProps & {\n /**\n * The client instance to provide to the component tree.\n */\n client: StreamVideoClient;\n};\n\n/**\n * StreamVideo is a provider component which should be used to wrap the entire application.\n * It provides the client object to all children components and initializes the i18n instance.\n */\nexport const StreamVideoProvider = ({\n children,\n client,\n i18nInstance,\n language,\n translationsOverrides,\n}: PropsWithChildren<StreamVideoProps>) => {\n return (\n <StreamVideoContext.Provider value={client}>\n <StreamI18nProvider\n i18nInstance={i18nInstance}\n language={language}\n translationsOverrides={translationsOverrides}\n >\n {children}\n </StreamI18nProvider>\n </StreamVideoContext.Provider>\n );\n};\n\n/**\n * Hook to access the nearest StreamVideo client instance.\n */\nexport const useStreamVideoClient = () => {\n return useContext(StreamVideoContext);\n};\n","/**\n * Checks whether we are using React Native\n */\nexport const isReactNative = () => {\n if (typeof navigator === 'undefined') return false;\n return navigator.product?.toLowerCase() === 'reactnative';\n};\n","import type { Observable } from 'rxjs';\nimport { useEffect, useState } from 'react';\nimport { RxUtils } from '@stream-io/video-client';\n\n/**\n * Utility hook which provides the current value of the given observable.\n *\n * @param observable$ the observable to read data from.\n * @param defaultValue a default value. Used when the observable data can't be read or emits an error.\n */\nexport const useObservableValue = <T>(\n observable$: Observable<T>,\n defaultValue?: T,\n) => {\n const [value, setValue] = useState<T>(() => {\n try {\n return RxUtils.getCurrentValue(observable$);\n } catch (err) {\n if (typeof defaultValue === 'undefined') throw err;\n return defaultValue;\n }\n });\n\n useEffect(() => {\n return RxUtils.createSubscription(observable$, setValue, (err) => {\n console.log('An error occurred while reading an observable', err);\n if (defaultValue) setValue(defaultValue);\n });\n }, [defaultValue, observable$]);\n\n return value;\n};\n","import {\n Call,\n CallClosedCaption,\n CallIngressResponse,\n CallSessionResponse,\n CallSettingsResponse,\n CallState,\n CallStatsReport,\n Comparator,\n EgressResponse,\n InputDeviceStatus,\n MemberResponse,\n OwnCapability,\n StreamVideoParticipant,\n UserResponse,\n} from '@stream-io/video-client';\nimport { useMemo, useState } from 'react';\nimport { Observable, of } from 'rxjs';\nimport { useCall } from '../contexts';\nimport { isReactNative } from '../helpers/platforms';\nimport { useObservableValue } from './useObservableValue';\n\n// kind-of memoized, used as a default value\nconst EMPTY_DEVICES_ARRAY = Object.freeze<MediaDeviceInfo[]>(\n [],\n) as MediaDeviceInfo[];\n\n/**\n * Utility hook, which provides the current call's state.\n */\nexport const useCallState = () => {\n const call = useCall();\n // return an empty and unlinked CallState object if there is no call in the provider\n // this ensures that the hooks always return a value and many null checks can be avoided\n if (!call) {\n const message =\n 'You are using useCallState() outside a Call context. ' +\n 'Please wrap your component in <StreamCall /> and provide a \"call\" instance.';\n console.warn(message);\n return new CallState();\n }\n return call.state;\n};\n\n/**\n * Utility hook which provides information whether the current call is being recorded. It will return `true` if the call is being recorded.\n */\nexport const useIsCallRecordingInProgress = (): boolean => {\n const { recording$ } = useCallState();\n return useObservableValue(recording$);\n};\n\n/**\n * Utility hook which provides information whether the current call is broadcasting.\n */\nexport const useIsCallHLSBroadcastingInProgress = (): boolean => {\n const { egress$ } = useCallState();\n const egress = useObservableValue(egress$);\n if (!egress) return false;\n return egress.broadcasting;\n};\n\n/**\n * Utility hook which provides information whether the current call is live.\n */\nexport const useIsCallLive = (): boolean => {\n const { backstage$ } = useCallState();\n const isBackstageOn = useObservableValue(backstage$);\n return !isBackstageOn;\n};\n\n/**\n * Returns the list of blocked users in the current call.\n */\nexport const useCallBlockedUserIds = (): string[] => {\n const { blockedUserIds$ } = useCallState();\n return useObservableValue(blockedUserIds$);\n};\n\n/**\n * Returns the timestamp when this call was created.\n */\nexport const useCallCreatedAt = (): Date | undefined => {\n const { createdAt$ } = useCallState();\n return useObservableValue(createdAt$);\n};\n\n/**\n * Returns the timestamp when this call was ended.\n */\nexport const useCallEndedAt = (): Date | undefined => {\n const { endedAt$ } = useCallState();\n return useObservableValue(endedAt$);\n};\n\n/**\n * Returns the timestamp telling when the call is scheduled to start.\n */\nexport const useCallStartsAt = (): Date | undefined => {\n const { startsAt$ } = useCallState();\n return useObservableValue(startsAt$);\n};\n\n/**\n * Returns the timestamp when this call was updated.\n */\nexport const useCallUpdatedAt = (): Date | undefined => {\n const { updatedAt$ } = useCallState();\n return useObservableValue(updatedAt$);\n};\n\n/**\n * Returns the information about the call's creator.\n */\nexport const useCallCreatedBy = (): UserResponse | undefined => {\n const { createdBy$ } = useCallState();\n return useObservableValue(createdBy$);\n};\n\n/**\n * Returns the call's custom data.\n */\nexport const useCallCustomData = (): Record<string, any> => {\n const { custom$ } = useCallState();\n return useObservableValue(custom$);\n};\n\n/**\n * Returns the call's Egress information.\n */\nexport const useCallEgress = (): EgressResponse | undefined => {\n const { egress$ } = useCallState();\n return useObservableValue(egress$);\n};\n\n/**\n * Returns the call's Ingress information.\n */\nexport const useCallIngress = (): CallIngressResponse | undefined => {\n const { ingress$ } = useCallState();\n return useObservableValue(ingress$);\n};\n\n/**\n * Returns the data for the current call session.\n */\nexport const useCallSession = (): CallSessionResponse | undefined => {\n const { session$ } = useCallState();\n return useObservableValue(session$);\n};\n\n/**\n * Returns the call's settings.\n */\nexport const useCallSettings = (): CallSettingsResponse | undefined => {\n const { settings$ } = useCallState();\n return useObservableValue(settings$);\n};\n\n/**\n * Returns whether the call has transcribing enabled.\n */\nexport const useIsCallTranscribingInProgress = (): boolean => {\n const { transcribing$ } = useCallState();\n return useObservableValue(transcribing$);\n};\n\n/**\n * Returns information about the user who has marked this call as ended.\n */\nexport const useCallEndedBy = (): UserResponse | undefined => {\n const { endedBy$ } = useCallState();\n return useObservableValue(endedBy$);\n};\n\n/**\n * Utility hook which provides a boolean indicating whether there is\n * a participant in the current call which shares their screen.\n */\nexport const useHasOngoingScreenShare = (): boolean => {\n const { hasOngoingScreenShare$ } = useCallState();\n return useObservableValue(hasOngoingScreenShare$);\n};\n\n/**\n * Utility hook which provides the latest stats report of the current call.\n *\n * The latest stats report of the current call.\n * When stats gathering is enabled, this observable will emit a new value\n * at a regular (configurable) interval.\n *\n * Consumers of this observable can implement their own batching logic\n * in case they want to show historical stats data.\n */\nexport const useCallStatsReport = (): CallStatsReport | undefined => {\n const { callStatsReport$ } = useCallState();\n return useObservableValue(callStatsReport$);\n};\n\n/**\n * Utility hook which provides the dominant speaker of the current call.\n */\nexport const useDominantSpeaker = (): StreamVideoParticipant | undefined => {\n const { dominantSpeaker$ } = useCallState();\n return useObservableValue(dominantSpeaker$);\n};\n\n/**\n * Utility hook which provides a list of call members.\n */\nexport const useCallMembers = (): MemberResponse[] => {\n const { members$ } = useCallState();\n return useObservableValue(members$);\n};\n\n/**\n * Utility hook providing the current calling state of the call. For example, `RINGING` or `JOINED`.\n */\nexport const useCallCallingState = () => {\n const { callingState$ } = useCallState();\n return useObservableValue(callingState$);\n};\n\n/**\n * Utility hook providing the actual start time of the current session.\n * Useful for calculating the call duration.\n */\nexport const useCallStartedAt = () => {\n const { startedAt$ } = useCallState();\n return useObservableValue(startedAt$);\n};\n\n/**\n * A hook which provides a list of all participants that have joined an active call.\n *\n * @param options.sortBy - A comparator function to sort the participants by.\n * Make sure to memoize output of the `combineComparators` function\n * (or keep it out of component's scope if possible) before passing it down to this property.\n */\nexport const useParticipants = ({\n sortBy,\n}: {\n /**\n * Make sure to memoize output of the `combineComparators` function\n * (or keep it out of component's scope if possible) before passing it down to this property.\n */\n sortBy?: Comparator<StreamVideoParticipant>;\n} = {}) => {\n const { participants$ } = useCallState();\n const participants = useObservableValue(participants$);\n\n return useMemo(() => {\n if (sortBy) {\n return [...participants].sort(sortBy);\n }\n return participants;\n }, [participants, sortBy]);\n};\n\n/**\n * A hook which provides a list of all participants that have joined an active call.\n * Unlike `useParticipants`, it returns a more stable reference that is not affected\n * by participant sort settings.\n *\n * @category Call State\n */\nexport const useRawParticipants = () => {\n const { rawParticipants$ } = useCallState();\n return useObservableValue(rawParticipants$);\n};\n\n/**\n * A hook which provides a StreamVideoLocalParticipant object.\n * It signals that I have joined a call.\n */\nexport const useLocalParticipant = () => {\n const { localParticipant$ } = useCallState();\n return useObservableValue(localParticipant$);\n};\n\n/**\n * A hook which provides a list of all other participants than me that have joined an active call.\n */\nexport const useRemoteParticipants = () => {\n const { remoteParticipants$ } = useCallState();\n return useObservableValue(remoteParticipants$);\n};\n\n/**\n * Returns the approximate participant count of the active call.\n * This includes the anonymous users as well, and it is computed on the server.\n */\nexport const useParticipantCount = () => {\n const { participantCount$ } = useCallState();\n return useObservableValue(participantCount$);\n};\n\n/**\n * Returns the approximate anonymous participant count of the active call.\n * The regular participants are not included in this count. It is computed on the server.\n */\nexport const useAnonymousParticipantCount = () => {\n const { anonymousParticipantCount$ } = useCallState();\n return useObservableValue(anonymousParticipantCount$);\n};\n\n/**\n * Returns the generated thumbnail of the current call, if enabled in settings.\n */\nexport const useCallThumbnail = () => {\n const { thumbnails$ } = useCallState();\n return useObservableValue(thumbnails$);\n};\n\n/**\n * A hook which returns the local participant's own capabilities.\n */\nexport const useOwnCapabilities = (): OwnCapability[] | undefined => {\n const { ownCapabilities$ } = useCallState();\n return useObservableValue(ownCapabilities$);\n};\n\n/**\n * Hook that returns true if the local participant has all the given permissions.\n *\n * @param permissions the permissions to check.\n */\nexport const useHasPermissions = (...permissions: OwnCapability[]): boolean => {\n const capabilities = useOwnCapabilities();\n return permissions.every((permission) => capabilities?.includes(permission));\n};\n\n/**\n * Returns the camera state of the current call.\n */\nexport const useCameraState = () => {\n const call = useCall();\n const { camera } = call as Call;\n\n const { state } = camera;\n const direction = useObservableValue(state.direction$);\n const mediaStream = useObservableValue(state.mediaStream$);\n const selectedDevice = useObservableValue(state.selectedDevice$);\n const { getDevices } = useLazyDeviceList(camera);\n const hasBrowserPermission = useObservableValue(state.hasBrowserPermission$);\n const isPromptingPermission = useObservableValue(\n state.isPromptingPermission$,\n );\n\n return {\n camera,\n direction,\n mediaStream,\n get devices() {\n return getDevices();\n },\n hasBrowserPermission,\n isPromptingPermission,\n selectedDevice,\n ...getComputedStatus(\n useObservableValue(state.status$),\n useObservableValue(state.optimisticStatus$),\n ),\n };\n};\n\n/**\n * Returns the microphone state of the current call.\n */\nexport const useMicrophoneState = () => {\n const call = useCall();\n const { microphone } = call as Call;\n\n const { state } = microphone;\n const mediaStream = useObservableValue(state.mediaStream$);\n const selectedDevice = useObservableValue(state.selectedDevice$);\n const { getDevices } = useLazyDeviceList(microphone);\n const hasBrowserPermission = useObservableValue(state.hasBrowserPermission$);\n const isPromptingPermission = useObservableValue(\n state.isPromptingPermission$,\n );\n const isSpeakingWhileMuted = useObservableValue(state.speakingWhileMuted$);\n\n return {\n microphone,\n mediaStream,\n get devices() {\n return getDevices();\n },\n selectedDevice,\n hasBrowserPermission,\n isPromptingPermission,\n isSpeakingWhileMuted,\n ...getComputedStatus(\n useObservableValue(state.status$),\n useObservableValue(state.optimisticStatus$),\n ),\n };\n};\n\n/**\n * Returns the speaker state of the current call.\n *\n * Note: This hook is not supported in React Native\n */\nexport const useSpeakerState = () => {\n if (isReactNative()) {\n throw new Error(\n 'This feature is not supported in React Native. Please visit https://getstream.io/video/docs/reactnative/core/camera-and-microphone/#speaker-management for more details',\n );\n }\n const call = useCall();\n const { speaker } = call as Call;\n\n const { getDevices } = useLazyDeviceList(speaker);\n const selectedDevice = useObservableValue(speaker.state.selectedDevice$);\n\n return {\n speaker,\n get devices() {\n return getDevices();\n },\n selectedDevice,\n isDeviceSelectionSupported: speaker.state.isDeviceSelectionSupported,\n };\n};\n\n/**\n * Returns the Screen Share state of the current call.\n */\nexport const useScreenShareState = () => {\n const call = useCall();\n const { screenShare } = call as Call;\n\n return {\n screenShare,\n mediaStream: useObservableValue(screenShare.state.mediaStream$),\n ...getComputedStatus(\n useObservableValue(screenShare.state.status$),\n useObservableValue(screenShare.state.optimisticStatus$),\n ),\n };\n};\n\n/**\n * Returns incoming video settings for the current call, including\n * global and per-participant manual video quality overrides.\n */\nexport const useIncomingVideoSettings = () => {\n const call = useCall() as Call;\n const settings = useObservableValue(\n call.dynascaleManager.incomingVideoSettings$,\n );\n return settings;\n};\n\n/**\n * Returns the current call's closed captions queue.\n */\nexport const useCallClosedCaptions = (): CallClosedCaption[] => {\n const { closedCaptions$ } = useCallState();\n return useObservableValue(closedCaptions$);\n};\n\n/**\n * Returns the current call's closed captions queue.\n */\nexport const useIsCallCaptioningInProgress = (): boolean => {\n const { captioning$ } = useCallState();\n return useObservableValue(captioning$);\n};\n\nfunction getComputedStatus(\n status: InputDeviceStatus,\n pendingStatus: InputDeviceStatus,\n) {\n const optimisticStatus = pendingStatus ?? status;\n\n return {\n status,\n optimisticStatus,\n isEnabled: status === 'enabled',\n isMute: status !== 'enabled',\n optimisticIsMute: optimisticStatus !== 'enabled',\n isTogglePending: optimisticStatus !== status,\n };\n}\n\ninterface DeviceManagerLike {\n listDevices(): Observable<MediaDeviceInfo[]>;\n}\n\nfunction useLazyDeviceList(manager: DeviceManagerLike) {\n const placeholderDevices$ = useMemo(() => of(EMPTY_DEVICES_ARRAY), []);\n const [devices$, setDevices$] = useState(placeholderDevices$);\n const devices = useObservableValue(devices$, EMPTY_DEVICES_ARRAY);\n\n const getDevices = () => {\n if (devices$ === placeholderDevices$) {\n setDevices$(manager.listDevices());\n }\n\n return devices;\n };\n\n return { getDevices };\n}\n","import { useStreamVideoClient } from '../contexts';\nimport { useObservableValue } from './useObservableValue';\n\n/**\n * Utility hook which provides access to client's state store.\n */\nexport const useStore = () => {\n const client = useStreamVideoClient();\n if (!client) {\n throw new Error(\n `StreamVideoClient isn't initialized or this hook is called outside of <StreamVideo> context.`,\n );\n }\n return client.state;\n};\n\n/**\n * Utility hook which provides a list of all notifications about created calls.\n * In the ring call settings, these calls can be outgoing (I have called somebody)\n * or incoming (somebody has called me).\n */\nexport const useCalls = () => {\n const { calls$ } = useStore();\n return useObservableValue(calls$);\n};\n\n/**\n * Returns the current connected user.\n */\nexport const useConnectedUser = () => {\n const { connectedUser$ } = useStore();\n return useObservableValue(connectedUser$);\n};\n","import { useCallback, useEffect, useState } from 'react';\nimport { useCall } from '../contexts';\nimport { useIsCallRecordingInProgress } from './callStateHooks';\n\n/**\n * Custom hook for toggling call recording in a video call.\n *\n * This hook provides functionality to start and stop call recording,\n * along with state management for tracking the recording status\n * and the loading indicator while awaiting a response.\n */\nexport const useToggleCallRecording = () => {\n const call = useCall();\n const isCallRecordingInProgress = useIsCallRecordingInProgress();\n const [isAwaitingResponse, setIsAwaitingResponse] = useState(false);\n\n // TODO: add permissions\n\n useEffect(() => {\n // we wait until call.recording_started/stopped event to flips the\n // `isCallRecordingInProgress` state variable.\n // Once the flip happens, we remove the loading indicator\n setIsAwaitingResponse((isAwaiting) => {\n if (isAwaiting) return false;\n return isAwaiting;\n });\n }, [isCallRecordingInProgress]);\n\n const toggleCallRecording = useCallback(async () => {\n try {\n setIsAwaitingResponse(true);\n if (isCallRecordingInProgress) {\n await call?.stopRecording();\n } else {\n await call?.startRecording();\n }\n } catch (e) {\n console.error(`Failed start recording`, e);\n throw e;\n }\n }, [call, isCallRecordingInProgress]);\n\n return { toggleCallRecording, isAwaitingResponse, isCallRecordingInProgress };\n};\n","import * as CallStateHooks from './callStateHooks';\n\nexport * from './useObservableValue';\n\nexport * from './store';\nexport * from './callUtilHooks';\n\n/**\n * A hook-alike function that exposes all call state hooks.\n */\nexport const useCallStateHooks = () => CallStateHooks;\n","import { OwnCapability } from '@stream-io/video-client';\n\nimport { PropsWithChildren } from 'react';\nimport { useCall } from '../contexts';\nimport { useCallStateHooks } from '../hooks';\n\ntype RestrictedProps = PropsWithChildren<{\n /**\n * Required grants for the component to be able to render supplied children elements\n */\n requiredGrants: OwnCapability[];\n /**\n * Render children only if user can request capability, but does not have it\n */\n canRequestOnly?: boolean;\n /**\n * Render children only if user has capability\n */\n hasPermissionsOnly?: boolean;\n /**\n * Require all grants specified in `requiredGrants` to be available in the `availableGrants`,\n * component by default requires only one grant to appear in both arrays to render its children\n */\n requireAll?: boolean;\n}>;\n\nexport const Restricted = ({\n canRequestOnly,\n hasPermissionsOnly,\n requiredGrants,\n requireAll = true,\n children,\n}: RestrictedProps) => {\n const call = useCall();\n const { useCallSettings, useOwnCapabilities } = useCallStateHooks();\n const ownCapabilities = useOwnCapabilities();\n const settings = useCallSettings();\n const hasPermissions = requiredGrants[requireAll ? 'every' : 'some'](\n (capability) => ownCapabilities?.includes(capability),\n );\n\n if (hasPermissionsOnly) return hasPermissions ? <>{children}</> : null;\n\n const canRequest = requiredGrants.some((capability) =>\n call?.permissionsContext.canRequest(capability, settings),\n );\n\n if (canRequestOnly) return canRequest ? <>{children}</> : null;\n\n if (hasPermissions || canRequest) return <>{children}</>;\n\n return null;\n};\n"],"names":["createContext","_jsx","useContext","useState","useEffect","useMemo","RxUtils","CallState","of","useCallback","_Fragment"],"mappings":";;;;;;;;AAGA,MAAM,iBAAiB,GAAGA,mBAAa,CAAmB,SAAS,CAAC;AAYpE;;AAEG;AACU,MAAA,kBAAkB,GAAG,CAChC,KAAiD,KAC/C;AACF,IAAA,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,KAAK;AAChC,IAAA,QACEC,cAAA,CAAC,iBAAiB,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,IAAI,EAAA,QAAA,EACpC,QAAQ,EAAA,CACkB;AAEjC;AAEA;;AAEG;AACI,MAAM,OAAO,GAAG,MAAK;AAC1B,IAAA,OAAOC,gBAAU,CAAC,iBAAiB,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AC,CAAC,UAAU,KAChD,IAAI,EAAE,kBAAkB,CAAC,UAAU,CAAC,UAAU,EAAE,QAAQ,CAAC,CAC1D;AAED,IAAA,IAAI,cAAc;QAAE,OAAO,UAAU,GAAGT,cAAA,CAAAS,mBAAA,EAAA,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAI,GAAG,IAAI;IAE9D,IAAI,cAAc,IAAI,UAAU;QAAE,OAAOT,cAAA,CAAAS,mBAAA,EAAA,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAI;AAExD,IAAA,OAAO,IAAI;AACb;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../../src/contexts/StreamCallContext.tsx","../../src/i18n/StreamI18n.ts","../../src/contexts/StreamI18nContext.tsx","../../src/contexts/StreamVideoContext.tsx","../../src/helpers/platforms.ts","../../src/hooks/useObservableValue.ts","../../src/hooks/callStateHooks.ts","../../src/hooks/store.ts","../../src/hooks/callUtilHooks.ts","../../src/hooks/index.ts","../../src/wrappers/Restricted.tsx"],"sourcesContent":["import { createContext, PropsWithChildren, useContext } from 'react';\nimport { Call } from '@stream-io/video-client';\n\nconst StreamCallContext = createContext<Call | undefined>(undefined);\n\n/**\n * The props for the StreamCallProvider component.\n */\nexport interface StreamCallProviderProps {\n /**\n * The call instance to provide to the component tree.\n */\n call?: Call;\n}\n\n/**\n * A provider for the call object.\n */\nexport const StreamCallProvider = (\n props: PropsWithChildren<StreamCallProviderProps>,\n) => {\n const { call, children } = props;\n return (\n <StreamCallContext.Provider value={call}>\n {children}\n </StreamCallContext.Provider>\n );\n};\n\n/**\n * A hook to get the call object from the closest provider.\n */\nexport const useCall = () => {\n return useContext(StreamCallContext);\n};\n","import i18next from 'i18next';\nimport {\n TranslationLanguage,\n TranslationsMap,\n TranslationsRegistry,\n TranslatorFunction,\n} from './types';\n\nconst mapToRegistry = (translationsMap: TranslationsMap, namespace: string) =>\n Object.entries(translationsMap).reduce((acc, [lng, translations]) => {\n acc[lng] = { [namespace]: translations };\n return acc;\n }, {} as TranslationsRegistry);\n\nexport const defaultTranslationFunction = (key: string) => key;\n\nexport type StreamI18nConstructor = {\n /** Language into which the provided strings are translated */\n currentLanguage?: TranslationLanguage;\n /** Fallback language which will be used if no translation is found for current language */\n fallbackLanguage?: TranslationLanguage;\n /** Logs info level to console output. Helps find issues with loading not working. */\n debug?: boolean;\n /** Custom translations that will be merged with the defaults provided by the library. */\n translationsOverrides?: TranslationsMap;\n};\n\nexport class StreamI18n {\n /** Exposed i18n instance from the i18next library */\n i18nInstance;\n /** Translator function that converts the provided string into its equivalent in the current language. */\n t: TranslatorFunction = defaultTranslationFunction;\n\n constructor({\n debug = false,\n currentLanguage = 'en',\n fallbackLanguage,\n translationsOverrides = { en: {} },\n }: StreamI18nConstructor = {}) {\n const ns = 'stream-video';\n this.i18nInstance = i18next.createInstance({\n debug,\n defaultNS: ns,\n fallbackLng: fallbackLanguage,\n interpolation: { escapeValue: false },\n keySeparator: false,\n lng: currentLanguage,\n nsSeparator: false,\n parseMissingKeyHandler: defaultTranslationFunction,\n resources: mapToRegistry(translationsOverrides, ns),\n });\n }\n\n get currentLanguage() {\n return this.i18nInstance.language;\n }\n\n get isInitialized() {\n return this.i18nInstance.isInitialized;\n }\n\n init = async () => {\n this.t = await this.i18nInstance.init();\n return this.t;\n };\n\n changeLanguage = async (language?: TranslationLanguage) => {\n this.t = await this.i18nInstance.changeLanguage(language);\n return this.t;\n };\n}\n","import {\n createContext,\n PropsWithChildren,\n useContext,\n useEffect,\n useMemo,\n useState,\n} from 'react';\nimport {\n defaultTranslationFunction,\n StreamI18n,\n TranslationLanguage,\n TranslationsMap,\n} from '../i18n';\n\ntype StreamI18nContextValue = {\n t: StreamI18n['t'];\n i18n?: StreamI18n;\n};\n\nconst StreamI18nContext = createContext<StreamI18nContextValue>({\n t: defaultTranslationFunction,\n});\n\ntype CreateI18nParams = {\n i18nInstance?: StreamI18n;\n language?: TranslationLanguage;\n fallbackLanguage?: TranslationLanguage;\n translationsOverrides?: TranslationsMap;\n};\n\nexport type StreamI18nProviderProps = CreateI18nParams;\n\nexport const StreamI18nProvider = ({\n children,\n ...createI18nParams\n}: PropsWithChildren<StreamI18nProviderProps>) => {\n const api = useCreateI18n(createI18nParams);\n return (\n <StreamI18nContext.Provider value={api}>\n {children}\n </StreamI18nContext.Provider>\n );\n};\n\nconst useCreateI18n = ({\n i18nInstance,\n language,\n fallbackLanguage,\n translationsOverrides,\n}: CreateI18nParams) => {\n const [i18n] = useState(\n () =>\n i18nInstance ||\n new StreamI18n({\n currentLanguage: language,\n fallbackLanguage,\n translationsOverrides,\n }),\n );\n const [t, setTranslationFn] = useState<StreamI18n['t']>(() => i18n.t);\n useEffect(() => {\n if (!i18n.isInitialized) {\n i18n.init().then(() => setTranslationFn(() => i18n.t));\n } else if (i18n.currentLanguage !== language) {\n i18n.changeLanguage(language).then(() => setTranslationFn(() => i18n.t));\n }\n }, [i18n, language]);\n\n return useMemo(() => ({ i18n, t }), [i18n, t]);\n};\n\n/**\n * A hook to get the i18n instance and translation function from the closest provider.\n *\n * Example usage:\n * const { t, i18n } = useI18n();\n * const message = t('hello_world');\n * console.log(message);\n */\nexport const useI18n = () => useContext(StreamI18nContext);\n","import { createContext, PropsWithChildren, useContext } from 'react';\nimport { StreamVideoClient } from '@stream-io/video-client';\nimport {\n StreamI18nProvider,\n StreamI18nProviderProps,\n} from './StreamI18nContext';\n\nconst StreamVideoContext = createContext<StreamVideoClient | undefined>(\n undefined,\n);\n\n/**\n * The props for the StreamVideoProvider component.\n */\nexport type StreamVideoProps = StreamI18nProviderProps & {\n /**\n * The client instance to provide to the component tree.\n */\n client: StreamVideoClient;\n};\n\n/**\n * StreamVideo is a provider component which should be used to wrap the entire application.\n * It provides the client object to all children components and initializes the i18n instance.\n */\nexport const StreamVideoProvider = ({\n children,\n client,\n i18nInstance,\n language,\n translationsOverrides,\n}: PropsWithChildren<StreamVideoProps>) => {\n return (\n <StreamVideoContext.Provider value={client}>\n <StreamI18nProvider\n i18nInstance={i18nInstance}\n language={language}\n translationsOverrides={translationsOverrides}\n >\n {children}\n </StreamI18nProvider>\n </StreamVideoContext.Provider>\n );\n};\n\n/**\n * Hook to access the nearest StreamVideo client instance.\n */\nexport const useStreamVideoClient = () => {\n return useContext(StreamVideoContext);\n};\n","/**\n * Checks whether we are using React Native\n */\nexport const isReactNative = () => {\n if (typeof navigator === 'undefined') return false;\n return navigator.product?.toLowerCase() === 'reactnative';\n};\n","import type { Observable } from 'rxjs';\nimport { useEffect, useState } from 'react';\nimport { RxUtils } from '@stream-io/video-client';\n\n/**\n * Utility hook which provides the current value of the given observable.\n *\n * @param observable$ the observable to read data from.\n * @param defaultValue a default value. Used when the observable data can't be read or emits an error.\n */\nexport const useObservableValue = <T>(\n observable$: Observable<T>,\n defaultValue?: T,\n) => {\n const [value, setValue] = useState<T>(() => {\n try {\n return RxUtils.getCurrentValue(observable$);\n } catch (err) {\n if (typeof defaultValue === 'undefined') throw err;\n return defaultValue;\n }\n });\n\n useEffect(() => {\n return RxUtils.createSubscription(observable$, setValue, (err) => {\n console.log('An error occurred while reading an observable', err);\n if (defaultValue) setValue(defaultValue);\n });\n }, [defaultValue, observable$]);\n\n return value;\n};\n","import {\n Call,\n CallClosedCaption,\n CallIngressResponse,\n CallSessionResponse,\n CallSettingsResponse,\n CallState,\n CallStatsReport,\n Comparator,\n EgressResponse,\n InputDeviceStatus,\n MemberResponse,\n OwnCapability,\n StreamVideoParticipant,\n UserResponse,\n} from '@stream-io/video-client';\nimport { useMemo, useState } from 'react';\nimport { Observable, of } from 'rxjs';\nimport { useCall } from '../contexts';\nimport { isReactNative } from '../helpers/platforms';\nimport { useObservableValue } from './useObservableValue';\n\n// kind-of memoized, used as a default value\nconst EMPTY_DEVICES_ARRAY = Object.freeze<MediaDeviceInfo[]>(\n [],\n) as MediaDeviceInfo[];\n\nexport type UseInputMediaDeviceOptions = {\n /**\n * If `true`, the hook will use the optimistic status to determine whether the device is muted or not.\n */\n optimisticUpdates?: boolean;\n};\n\n/**\n * Utility hook, which provides the current call's state.\n */\nexport const useCallState = () => {\n const call = useCall();\n // return an empty and unlinked CallState object if there is no call in the provider\n // this ensures that the hooks always return a value and many null checks can be avoided\n if (!call) {\n const message =\n 'You are using useCallState() outside a Call context. ' +\n 'Please wrap your component in <StreamCall /> and provide a \"call\" instance.';\n console.warn(message);\n return new CallState();\n }\n return call.state;\n};\n\n/**\n * Utility hook which provides information whether the current call is being recorded. It will return `true` if the call is being recorded.\n */\nexport const useIsCallRecordingInProgress = (): boolean => {\n const { recording$ } = useCallState();\n return useObservableValue(recording$);\n};\n\n/**\n * Utility hook which provides information whether the current call is broadcasting.\n */\nexport const useIsCallHLSBroadcastingInProgress = (): boolean => {\n const { egress$ } = useCallState();\n const egress = useObservableValue(egress$);\n if (!egress) return false;\n return egress.broadcasting;\n};\n\n/**\n * Utility hook which provides information whether the current call is live.\n */\nexport const useIsCallLive = (): boolean => {\n const { backstage$ } = useCallState();\n const isBackstageOn = useObservableValue(backstage$);\n return !isBackstageOn;\n};\n\n/**\n * Returns the list of blocked users in the current call.\n */\nexport const useCallBlockedUserIds = (): string[] => {\n const { blockedUserIds$ } = useCallState();\n return useObservableValue(blockedUserIds$);\n};\n\n/**\n * Returns the timestamp when this call was created.\n */\nexport const useCallCreatedAt = (): Date | undefined => {\n const { createdAt$ } = useCallState();\n return useObservableValue(createdAt$);\n};\n\n/**\n * Returns the timestamp when this call was ended.\n */\nexport const useCallEndedAt = (): Date | undefined => {\n const { endedAt$ } = useCallState();\n return useObservableValue(endedAt$);\n};\n\n/**\n * Returns the timestamp telling when the call is scheduled to start.\n */\nexport const useCallStartsAt = (): Date | undefined => {\n const { startsAt$ } = useCallState();\n return useObservableValue(startsAt$);\n};\n\n/**\n * Returns the timestamp when this call was updated.\n */\nexport const useCallUpdatedAt = (): Date | undefined => {\n const { updatedAt$ } = useCallState();\n return useObservableValue(updatedAt$);\n};\n\n/**\n * Returns the information about the call's creator.\n */\nexport const useCallCreatedBy = (): UserResponse | undefined => {\n const { createdBy$ } = useCallState();\n return useObservableValue(createdBy$);\n};\n\n/**\n * Returns the call's custom data.\n */\nexport const useCallCustomData = (): Record<string, any> => {\n const { custom$ } = useCallState();\n return useObservableValue(custom$);\n};\n\n/**\n * Returns the call's Egress information.\n */\nexport const useCallEgress = (): EgressResponse | undefined => {\n const { egress$ } = useCallState();\n return useObservableValue(egress$);\n};\n\n/**\n * Returns the call's Ingress information.\n */\nexport const useCallIngress = (): CallIngressResponse | undefined => {\n const { ingress$ } = useCallState();\n return useObservableValue(ingress$);\n};\n\n/**\n * Returns the data for the current call session.\n */\nexport const useCallSession = (): CallSessionResponse | undefined => {\n const { session$ } = useCallState();\n return useObservableValue(session$);\n};\n\n/**\n * Returns the call's settings.\n */\nexport const useCallSettings = (): CallSettingsResponse | undefined => {\n const { settings$ } = useCallState();\n return useObservableValue(settings$);\n};\n\n/**\n * Returns whether the call has transcribing enabled.\n */\nexport const useIsCallTranscribingInProgress = (): boolean => {\n const { transcribing$ } = useCallState();\n return useObservableValue(transcribing$);\n};\n\n/**\n * Returns information about the user who has marked this call as ended.\n */\nexport const useCallEndedBy = (): UserResponse | undefined => {\n const { endedBy$ } = useCallState();\n return useObservableValue(endedBy$);\n};\n\n/**\n * Utility hook which provides a boolean indicating whether there is\n * a participant in the current call which shares their screen.\n */\nexport const useHasOngoingScreenShare = (): boolean => {\n const { hasOngoingScreenShare$ } = useCallState();\n return useObservableValue(hasOngoingScreenShare$);\n};\n\n/**\n * Utility hook which provides the latest stats report of the current call.\n *\n * The latest stats report of the current call.\n * When stats gathering is enabled, this observable will emit a new value\n * at a regular (configurable) interval.\n *\n * Consumers of this observable can implement their own batching logic\n * in case they want to show historical stats data.\n */\nexport const useCallStatsReport = (): CallStatsReport | undefined => {\n const { callStatsReport$ } = useCallState();\n return useObservableValue(callStatsReport$);\n};\n\n/**\n * Utility hook which provides the dominant speaker of the current call.\n */\nexport const useDominantSpeaker = (): StreamVideoParticipant | undefined => {\n const { dominantSpeaker$ } = useCallState();\n return useObservableValue(dominantSpeaker$);\n};\n\n/**\n * Utility hook which provides a list of call members.\n */\nexport const useCallMembers = (): MemberResponse[] => {\n const { members$ } = useCallState();\n return useObservableValue(members$);\n};\n\n/**\n * Utility hook providing the current calling state of the call. For example, `RINGING` or `JOINED`.\n */\nexport const useCallCallingState = () => {\n const { callingState$ } = useCallState();\n return useObservableValue(callingState$);\n};\n\n/**\n * Utility hook providing the actual start time of the current session.\n * Useful for calculating the call duration.\n */\nexport const useCallStartedAt = () => {\n const { startedAt$ } = useCallState();\n return useObservableValue(startedAt$);\n};\n\n/**\n * A hook which provides a list of all participants that have joined an active call.\n *\n * @param options.sortBy - A comparator function to sort the participants by.\n * Make sure to memoize output of the `combineComparators` function\n * (or keep it out of component's scope if possible) before passing it down to this property.\n */\nexport const useParticipants = ({\n sortBy,\n}: {\n /**\n * Make sure to memoize output of the `combineComparators` function\n * (or keep it out of component's scope if possible) before passing it down to this property.\n */\n sortBy?: Comparator<StreamVideoParticipant>;\n} = {}) => {\n const { participants$ } = useCallState();\n const participants = useObservableValue(participants$);\n\n return useMemo(() => {\n if (sortBy) {\n return [...participants].sort(sortBy);\n }\n return participants;\n }, [participants, sortBy]);\n};\n\n/**\n * A hook which provides a list of all participants that have joined an active call.\n * Unlike `useParticipants`, it returns a more stable reference that is not affected\n * by participant sort settings.\n *\n * @category Call State\n */\nexport const useRawParticipants = () => {\n const { rawParticipants$ } = useCallState();\n return useObservableValue(rawParticipants$);\n};\n\n/**\n * A hook which provides a StreamVideoLocalParticipant object.\n * It signals that I have joined a call.\n */\nexport const useLocalParticipant = () => {\n const { localParticipant$ } = useCallState();\n return useObservableValue(localParticipant$);\n};\n\n/**\n * A hook which provides a list of all other participants than me that have joined an active call.\n */\nexport const useRemoteParticipants = () => {\n const { remoteParticipants$ } = useCallState();\n return useObservableValue(remoteParticipants$);\n};\n\n/**\n * Returns the approximate participant count of the active call.\n * This includes the anonymous users as well, and it is computed on the server.\n */\nexport const useParticipantCount = () => {\n const { participantCount$ } = useCallState();\n return useObservableValue(participantCount$);\n};\n\n/**\n * Returns the approximate anonymous participant count of the active call.\n * The regular participants are not included in this count. It is computed on the server.\n */\nexport const useAnonymousParticipantCount = () => {\n const { anonymousParticipantCount$ } = useCallState();\n return useObservableValue(anonymousParticipantCount$);\n};\n\n/**\n * Returns the generated thumbnail of the current call, if enabled in settings.\n */\nexport const useCallThumbnail = () => {\n const { thumbnails$ } = useCallState();\n return useObservableValue(thumbnails$);\n};\n\n/**\n * A hook which returns the local participant's own capabilities.\n */\nexport const useOwnCapabilities = (): OwnCapability[] | undefined => {\n const { ownCapabilities$ } = useCallState();\n return useObservableValue(ownCapabilities$);\n};\n\n/**\n * Hook that returns true if the local participant has all the given permissions.\n *\n * @param permissions the permissions to check.\n */\nexport const useHasPermissions = (...permissions: OwnCapability[]): boolean => {\n const capabilities = useOwnCapabilities();\n return permissions.every((permission) => capabilities?.includes(permission));\n};\n\n/**\n * Returns the camera state of the current call.\n */\nexport const useCameraState = ({\n optimisticUpdates = true,\n}: UseInputMediaDeviceOptions = {}) => {\n const call = useCall();\n const { camera } = call as Call;\n\n const { state } = camera;\n const direction = useObservableValue(state.direction$);\n const mediaStream = useObservableValue(state.mediaStream$);\n const selectedDevice = useObservableValue(state.selectedDevice$);\n const { getDevices } = useLazyDeviceList(camera);\n const hasBrowserPermission = useObservableValue(state.hasBrowserPermission$);\n const isPromptingPermission = useObservableValue(\n state.isPromptingPermission$,\n );\n\n return {\n camera,\n direction,\n mediaStream,\n get devices() {\n return getDevices();\n },\n hasBrowserPermission,\n isPromptingPermission,\n selectedDevice,\n ...getComputedStatus(\n useObservableValue(state.status$),\n useObservableValue(state.optimisticStatus$),\n { optimisticUpdates },\n ),\n };\n};\n\n/**\n * Returns the microphone state of the current call.\n */\nexport const useMicrophoneState = ({\n optimisticUpdates = true,\n}: UseInputMediaDeviceOptions = {}) => {\n const call = useCall();\n const { microphone } = call as Call;\n\n const { state } = microphone;\n const mediaStream = useObservableValue(state.mediaStream$);\n const selectedDevice = useObservableValue(state.selectedDevice$);\n const { getDevices } = useLazyDeviceList(microphone);\n const hasBrowserPermission = useObservableValue(state.hasBrowserPermission$);\n const isPromptingPermission = useObservableValue(\n state.isPromptingPermission$,\n );\n const isSpeakingWhileMuted = useObservableValue(state.speakingWhileMuted$);\n\n return {\n microphone,\n mediaStream,\n get devices() {\n return getDevices();\n },\n selectedDevice,\n hasBrowserPermission,\n isPromptingPermission,\n isSpeakingWhileMuted,\n ...getComputedStatus(\n useObservableValue(state.status$),\n useObservableValue(state.optimisticStatus$),\n { optimisticUpdates },\n ),\n };\n};\n\n/**\n * Returns the speaker state of the current call.\n *\n * Note: This hook is not supported in React Native\n */\nexport const useSpeakerState = () => {\n if (isReactNative()) {\n throw new Error(\n 'This feature is not supported in React Native. Please visit https://getstream.io/video/docs/reactnative/core/camera-and-microphone/#speaker-management for more details',\n );\n }\n const call = useCall();\n const { speaker } = call as Call;\n\n const { getDevices } = useLazyDeviceList(speaker);\n const selectedDevice = useObservableValue(speaker.state.selectedDevice$);\n\n return {\n speaker,\n get devices() {\n return getDevices();\n },\n selectedDevice,\n isDeviceSelectionSupported: speaker.state.isDeviceSelectionSupported,\n };\n};\n\n/**\n * Returns the Screen Share state of the current call.\n */\nexport const useScreenShareState = ({\n optimisticUpdates = true,\n}: UseInputMediaDeviceOptions = {}) => {\n const call = useCall();\n const { screenShare } = call as Call;\n\n return {\n screenShare,\n mediaStream: useObservableValue(screenShare.state.mediaStream$),\n ...getComputedStatus(\n useObservableValue(screenShare.state.status$),\n useObservableValue(screenShare.state.optimisticStatus$),\n { optimisticUpdates },\n ),\n };\n};\n\n/**\n * Returns incoming video settings for the current call, including\n * global and per-participant manual video quality overrides.\n */\nexport const useIncomingVideoSettings = () => {\n const call = useCall() as Call;\n const settings = useObservableValue(\n call.dynascaleManager.incomingVideoSettings$,\n );\n return settings;\n};\n\n/**\n * Returns the current call's closed captions queue.\n */\nexport const useCallClosedCaptions = (): CallClosedCaption[] => {\n const { closedCaptions$ } = useCallState();\n return useObservableValue(closedCaptions$);\n};\n\n/**\n * Returns the current call's closed captions queue.\n */\nexport const useIsCallCaptioningInProgress = (): boolean => {\n const { captioning$ } = useCallState();\n return useObservableValue(captioning$);\n};\n\nfunction getComputedStatus(\n status: InputDeviceStatus,\n pendingStatus: InputDeviceStatus,\n options: Required<UseInputMediaDeviceOptions>,\n) {\n const optimisticStatus = pendingStatus ?? status;\n\n return {\n status,\n optimisticStatus,\n isEnabled: status === 'enabled',\n isMute: status !== 'enabled',\n optimisticIsMute: optimisticStatus !== 'enabled',\n isTogglePending: optimisticStatus !== status,\n /**\n * If optimistic updates are enabled (`options.optimisticUpdates`), we\n * consider the optimistic status to determine whether the device is muted or not.\n * Otherwise, we rely on the actual status.\n */\n optionsAwareIsMute: options.optimisticUpdates\n ? optimisticStatus !== 'enabled'\n : status !== 'enabled',\n };\n}\n\ninterface DeviceManagerLike {\n listDevices(): Observable<MediaDeviceInfo[]>;\n}\n\nfunction useLazyDeviceList(manager: DeviceManagerLike) {\n const placeholderDevices$ = useMemo(() => of(EMPTY_DEVICES_ARRAY), []);\n const [devices$, setDevices$] = useState(placeholderDevices$);\n const devices = useObservableValue(devices$, EMPTY_DEVICES_ARRAY);\n\n const getDevices = () => {\n if (devices$ === placeholderDevices$) {\n setDevices$(manager.listDevices());\n }\n\n return devices;\n };\n\n return { getDevices };\n}\n","import { useStreamVideoClient } from '../contexts';\nimport { useObservableValue } from './useObservableValue';\n\n/**\n * Utility hook which provides access to client's state store.\n */\nexport const useStore = () => {\n const client = useStreamVideoClient();\n if (!client) {\n throw new Error(\n `StreamVideoClient isn't initialized or this hook is called outside of <StreamVideo> context.`,\n );\n }\n return client.state;\n};\n\n/**\n * Utility hook which provides a list of all notifications about created calls.\n * In the ring call settings, these calls can be outgoing (I have called somebody)\n * or incoming (somebody has called me).\n */\nexport const useCalls = () => {\n const { calls$ } = useStore();\n return useObservableValue(calls$);\n};\n\n/**\n * Returns the current connected user.\n */\nexport const useConnectedUser = () => {\n const { connectedUser$ } = useStore();\n return useObservableValue(connectedUser$);\n};\n","import { useCallback, useEffect, useState } from 'react';\nimport { useCall } from '../contexts';\nimport { useIsCallRecordingInProgress } from './callStateHooks';\n\n/**\n * Custom hook for toggling call recording in a video call.\n *\n * This hook provides functionality to start and stop call recording,\n * along with state management for tracking the recording status\n * and the loading indicator while awaiting a response.\n */\nexport const useToggleCallRecording = () => {\n const call = useCall();\n const isCallRecordingInProgress = useIsCallRecordingInProgress();\n const [isAwaitingResponse, setIsAwaitingResponse] = useState(false);\n\n // TODO: add permissions\n\n useEffect(() => {\n // we wait until call.recording_started/stopped event to flips the\n // `isCallRecordingInProgress` state variable.\n // Once the flip happens, we remove the loading indicator\n setIsAwaitingResponse((isAwaiting) => {\n if (isAwaiting) return false;\n return isAwaiting;\n });\n }, [isCallRecordingInProgress]);\n\n const toggleCallRecording = useCallback(async () => {\n try {\n setIsAwaitingResponse(true);\n if (isCallRecordingInProgress) {\n await call?.stopRecording();\n } else {\n await call?.startRecording();\n }\n } catch (e) {\n console.error(`Failed start recording`, e);\n throw e;\n }\n }, [call, isCallRecordingInProgress]);\n\n return { toggleCallRecording, isAwaitingResponse, isCallRecordingInProgress };\n};\n","import * as CallStateHooks from './callStateHooks';\n\nexport * from './useObservableValue';\n\nexport * from './store';\nexport * from './callUtilHooks';\n\nexport type { UseInputMediaDeviceOptions } from './callStateHooks';\n\n/**\n * A hook-alike function that exposes all call state hooks.\n */\nexport const useCallStateHooks = () => CallStateHooks;\n","import { OwnCapability } from '@stream-io/video-client';\n\nimport { PropsWithChildren } from 'react';\nimport { useCall } from '../contexts';\nimport { useCallStateHooks } from '../hooks';\n\ntype RestrictedProps = PropsWithChildren<{\n /**\n * Required grants for the component to be able to render supplied children elements\n */\n requiredGrants: OwnCapability[];\n /**\n * Render children only if user can request capability, but does not have it\n */\n canRequestOnly?: boolean;\n /**\n * Render children only if user has capability\n */\n hasPermissionsOnly?: boolean;\n /**\n * Require all grants specified in `requiredGrants` to be available in the `availableGrants`,\n * component by default requires only one grant to appear in both arrays to render its children\n */\n requireAll?: boolean;\n}>;\n\nexport const Restricted = ({\n canRequestOnly,\n hasPermissionsOnly,\n requiredGrants,\n requireAll = true,\n children,\n}: RestrictedProps) => {\n const call = useCall();\n const { useCallSettings, useOwnCapabilities } = useCallStateHooks();\n const ownCapabilities = useOwnCapabilities();\n const settings = useCallSettings();\n const hasPermissions = requiredGrants[requireAll ? 'every' : 'some'](\n (capability) => ownCapabilities?.includes(capability),\n );\n\n if (hasPermissionsOnly) return hasPermissions ? <>{children}</> : null;\n\n const canRequest = requiredGrants.some((capability) =>\n call?.permissionsContext.canRequest(capability, settings),\n );\n\n if (canRequestOnly) return canRequest ? <>{children}</> : null;\n\n if (hasPermissions || canRequest) return <>{children}</>;\n\n return null;\n};\n"],"names":["createContext","_jsx","useContext","useState","useEffect","useMemo","RxUtils","CallState","of","useCallback","_Fragment"],"mappings":";;;;;;;;AAGA,MAAM,iBAAiB,GAAGA,mBAAa,CAAmB,SAAS,CAAC;AAYpE;;AAEG;AACU,MAAA,kBAAkB,GAAG,CAChC,KAAiD,KAC/C;AACF,IAAA,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,KAAK;AAChC,IAAA,QACEC,cAAA,CAAC,iBAAiB,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,IAAI,EAAA,QAAA,EACpC,QAAQ,EAAA,CACkB;AAEjC;AAEA;;AAEG;AACI,MAAM,OAAO,GAAG,MAAK;AAC1B,IAAA,OAAOC,gBAAU,CAAC,iBAAiB,CAAC;AACtC;;AC1BA,MAAM,aAAa,GAAG,CAAC,eAAgC,EAAE,SAAiB,KACxE,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,YAAY,CAAC,KAAI;IAClE,GAAG,CAAC,GAAG,CAAC,G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AAS,mBAAA,EAAA,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAI,GAAG,IAAI;IAEtE,MAAM,UAAU,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC,UAAU,KAChD,IAAI,EAAE,kBAAkB,CAAC,UAAU,CAAC,UAAU,EAAE,QAAQ,CAAC,CAC1D;AAED,IAAA,IAAI,cAAc;QAAE,OAAO,UAAU,GAAGT,cAAA,CAAAS,mBAAA,EAAA,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAI,GAAG,IAAI;IAE9D,IAAI,cAAc,IAAI,UAAU;QAAE,OAAOT,cAAA,CAAAS,mBAAA,EAAA,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAI;AAExD,IAAA,OAAO,IAAI;AACb;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.es.js
CHANGED
|
@@ -412,7 +412,7 @@ const useHasPermissions = (...permissions) => {
|
|
|
412
412
|
/**
|
|
413
413
|
* Returns the camera state of the current call.
|
|
414
414
|
*/
|
|
415
|
-
const useCameraState = () => {
|
|
415
|
+
const useCameraState = ({ optimisticUpdates = true, } = {}) => {
|
|
416
416
|
const call = useCall();
|
|
417
417
|
const { camera } = call;
|
|
418
418
|
const { state } = camera;
|
|
@@ -432,13 +432,13 @@ const useCameraState = () => {
|
|
|
432
432
|
hasBrowserPermission,
|
|
433
433
|
isPromptingPermission,
|
|
434
434
|
selectedDevice,
|
|
435
|
-
...getComputedStatus(useObservableValue(state.status$), useObservableValue(state.optimisticStatus$)),
|
|
435
|
+
...getComputedStatus(useObservableValue(state.status$), useObservableValue(state.optimisticStatus$), { optimisticUpdates }),
|
|
436
436
|
};
|
|
437
437
|
};
|
|
438
438
|
/**
|
|
439
439
|
* Returns the microphone state of the current call.
|
|
440
440
|
*/
|
|
441
|
-
const useMicrophoneState = () => {
|
|
441
|
+
const useMicrophoneState = ({ optimisticUpdates = true, } = {}) => {
|
|
442
442
|
const call = useCall();
|
|
443
443
|
const { microphone } = call;
|
|
444
444
|
const { state } = microphone;
|
|
@@ -458,7 +458,7 @@ const useMicrophoneState = () => {
|
|
|
458
458
|
hasBrowserPermission,
|
|
459
459
|
isPromptingPermission,
|
|
460
460
|
isSpeakingWhileMuted,
|
|
461
|
-
...getComputedStatus(useObservableValue(state.status$), useObservableValue(state.optimisticStatus$)),
|
|
461
|
+
...getComputedStatus(useObservableValue(state.status$), useObservableValue(state.optimisticStatus$), { optimisticUpdates }),
|
|
462
462
|
};
|
|
463
463
|
};
|
|
464
464
|
/**
|
|
@@ -486,13 +486,13 @@ const useSpeakerState = () => {
|
|
|
486
486
|
/**
|
|
487
487
|
* Returns the Screen Share state of the current call.
|
|
488
488
|
*/
|
|
489
|
-
const useScreenShareState = () => {
|
|
489
|
+
const useScreenShareState = ({ optimisticUpdates = true, } = {}) => {
|
|
490
490
|
const call = useCall();
|
|
491
491
|
const { screenShare } = call;
|
|
492
492
|
return {
|
|
493
493
|
screenShare,
|
|
494
494
|
mediaStream: useObservableValue(screenShare.state.mediaStream$),
|
|
495
|
-
...getComputedStatus(useObservableValue(screenShare.state.status$), useObservableValue(screenShare.state.optimisticStatus$)),
|
|
495
|
+
...getComputedStatus(useObservableValue(screenShare.state.status$), useObservableValue(screenShare.state.optimisticStatus$), { optimisticUpdates }),
|
|
496
496
|
};
|
|
497
497
|
};
|
|
498
498
|
/**
|
|
@@ -518,7 +518,7 @@ const useIsCallCaptioningInProgress = () => {
|
|
|
518
518
|
const { captioning$ } = useCallState();
|
|
519
519
|
return useObservableValue(captioning$);
|
|
520
520
|
};
|
|
521
|
-
function getComputedStatus(status, pendingStatus) {
|
|
521
|
+
function getComputedStatus(status, pendingStatus, options) {
|
|
522
522
|
const optimisticStatus = pendingStatus ?? status;
|
|
523
523
|
return {
|
|
524
524
|
status,
|
|
@@ -527,6 +527,14 @@ function getComputedStatus(status, pendingStatus) {
|
|
|
527
527
|
isMute: status !== 'enabled',
|
|
528
528
|
optimisticIsMute: optimisticStatus !== 'enabled',
|
|
529
529
|
isTogglePending: optimisticStatus !== status,
|
|
530
|
+
/**
|
|
531
|
+
* If optimistic updates are enabled (`options.optimisticUpdates`), we
|
|
532
|
+
* consider the optimistic status to determine whether the device is muted or not.
|
|
533
|
+
* Otherwise, we rely on the actual status.
|
|
534
|
+
*/
|
|
535
|
+
optionsAwareIsMute: options.optimisticUpdates
|
|
536
|
+
? optimisticStatus !== 'enabled'
|
|
537
|
+
: status !== 'enabled',
|
|
530
538
|
};
|
|
531
539
|
}
|
|
532
540
|
function useLazyDeviceList(manager) {
|
package/dist/index.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es.js","sources":["../../src/contexts/StreamCallContext.tsx","../../src/i18n/StreamI18n.ts","../../src/contexts/StreamI18nContext.tsx","../../src/contexts/StreamVideoContext.tsx","../../src/helpers/platforms.ts","../../src/hooks/useObservableValue.ts","../../src/hooks/callStateHooks.ts","../../src/hooks/store.ts","../../src/hooks/callUtilHooks.ts","../../src/hooks/index.ts","../../src/wrappers/Restricted.tsx"],"sourcesContent":["import { createContext, PropsWithChildren, useContext } from 'react';\nimport { Call } from '@stream-io/video-client';\n\nconst StreamCallContext = createContext<Call | undefined>(undefined);\n\n/**\n * The props for the StreamCallProvider component.\n */\nexport interface StreamCallProviderProps {\n /**\n * The call instance to provide to the component tree.\n */\n call?: Call;\n}\n\n/**\n * A provider for the call object.\n */\nexport const StreamCallProvider = (\n props: PropsWithChildren<StreamCallProviderProps>,\n) => {\n const { call, children } = props;\n return (\n <StreamCallContext.Provider value={call}>\n {children}\n </StreamCallContext.Provider>\n );\n};\n\n/**\n * A hook to get the call object from the closest provider.\n */\nexport const useCall = () => {\n return useContext(StreamCallContext);\n};\n","import i18next from 'i18next';\nimport {\n TranslationLanguage,\n TranslationsMap,\n TranslationsRegistry,\n TranslatorFunction,\n} from './types';\n\nconst mapToRegistry = (translationsMap: TranslationsMap, namespace: string) =>\n Object.entries(translationsMap).reduce((acc, [lng, translations]) => {\n acc[lng] = { [namespace]: translations };\n return acc;\n }, {} as TranslationsRegistry);\n\nexport const defaultTranslationFunction = (key: string) => key;\n\nexport type StreamI18nConstructor = {\n /** Language into which the provided strings are translated */\n currentLanguage?: TranslationLanguage;\n /** Fallback language which will be used if no translation is found for current language */\n fallbackLanguage?: TranslationLanguage;\n /** Logs info level to console output. Helps find issues with loading not working. */\n debug?: boolean;\n /** Custom translations that will be merged with the defaults provided by the library. */\n translationsOverrides?: TranslationsMap;\n};\n\nexport class StreamI18n {\n /** Exposed i18n instance from the i18next library */\n i18nInstance;\n /** Translator function that converts the provided string into its equivalent in the current language. */\n t: TranslatorFunction = defaultTranslationFunction;\n\n constructor({\n debug = false,\n currentLanguage = 'en',\n fallbackLanguage,\n translationsOverrides = { en: {} },\n }: StreamI18nConstructor = {}) {\n const ns = 'stream-video';\n this.i18nInstance = i18next.createInstance({\n debug,\n defaultNS: ns,\n fallbackLng: fallbackLanguage,\n interpolation: { escapeValue: false },\n keySeparator: false,\n lng: currentLanguage,\n nsSeparator: false,\n parseMissingKeyHandler: defaultTranslationFunction,\n resources: mapToRegistry(translationsOverrides, ns),\n });\n }\n\n get currentLanguage() {\n return this.i18nInstance.language;\n }\n\n get isInitialized() {\n return this.i18nInstance.isInitialized;\n }\n\n init = async () => {\n this.t = await this.i18nInstance.init();\n return this.t;\n };\n\n changeLanguage = async (language?: TranslationLanguage) => {\n this.t = await this.i18nInstance.changeLanguage(language);\n return this.t;\n };\n}\n","import {\n createContext,\n PropsWithChildren,\n useContext,\n useEffect,\n useMemo,\n useState,\n} from 'react';\nimport {\n defaultTranslationFunction,\n StreamI18n,\n TranslationLanguage,\n TranslationsMap,\n} from '../i18n';\n\ntype StreamI18nContextValue = {\n t: StreamI18n['t'];\n i18n?: StreamI18n;\n};\n\nconst StreamI18nContext = createContext<StreamI18nContextValue>({\n t: defaultTranslationFunction,\n});\n\ntype CreateI18nParams = {\n i18nInstance?: StreamI18n;\n language?: TranslationLanguage;\n fallbackLanguage?: TranslationLanguage;\n translationsOverrides?: TranslationsMap;\n};\n\nexport type StreamI18nProviderProps = CreateI18nParams;\n\nexport const StreamI18nProvider = ({\n children,\n ...createI18nParams\n}: PropsWithChildren<StreamI18nProviderProps>) => {\n const api = useCreateI18n(createI18nParams);\n return (\n <StreamI18nContext.Provider value={api}>\n {children}\n </StreamI18nContext.Provider>\n );\n};\n\nconst useCreateI18n = ({\n i18nInstance,\n language,\n fallbackLanguage,\n translationsOverrides,\n}: CreateI18nParams) => {\n const [i18n] = useState(\n () =>\n i18nInstance ||\n new StreamI18n({\n currentLanguage: language,\n fallbackLanguage,\n translationsOverrides,\n }),\n );\n const [t, setTranslationFn] = useState<StreamI18n['t']>(() => i18n.t);\n useEffect(() => {\n if (!i18n.isInitialized) {\n i18n.init().then(() => setTranslationFn(() => i18n.t));\n } else if (i18n.currentLanguage !== language) {\n i18n.changeLanguage(language).then(() => setTranslationFn(() => i18n.t));\n }\n }, [i18n, language]);\n\n return useMemo(() => ({ i18n, t }), [i18n, t]);\n};\n\n/**\n * A hook to get the i18n instance and translation function from the closest provider.\n *\n * Example usage:\n * const { t, i18n } = useI18n();\n * const message = t('hello_world');\n * console.log(message);\n */\nexport const useI18n = () => useContext(StreamI18nContext);\n","import { createContext, PropsWithChildren, useContext } from 'react';\nimport { StreamVideoClient } from '@stream-io/video-client';\nimport {\n StreamI18nProvider,\n StreamI18nProviderProps,\n} from './StreamI18nContext';\n\nconst StreamVideoContext = createContext<StreamVideoClient | undefined>(\n undefined,\n);\n\n/**\n * The props for the StreamVideoProvider component.\n */\nexport type StreamVideoProps = StreamI18nProviderProps & {\n /**\n * The client instance to provide to the component tree.\n */\n client: StreamVideoClient;\n};\n\n/**\n * StreamVideo is a provider component which should be used to wrap the entire application.\n * It provides the client object to all children components and initializes the i18n instance.\n */\nexport const StreamVideoProvider = ({\n children,\n client,\n i18nInstance,\n language,\n translationsOverrides,\n}: PropsWithChildren<StreamVideoProps>) => {\n return (\n <StreamVideoContext.Provider value={client}>\n <StreamI18nProvider\n i18nInstance={i18nInstance}\n language={language}\n translationsOverrides={translationsOverrides}\n >\n {children}\n </StreamI18nProvider>\n </StreamVideoContext.Provider>\n );\n};\n\n/**\n * Hook to access the nearest StreamVideo client instance.\n */\nexport const useStreamVideoClient = () => {\n return useContext(StreamVideoContext);\n};\n","/**\n * Checks whether we are using React Native\n */\nexport const isReactNative = () => {\n if (typeof navigator === 'undefined') return false;\n return navigator.product?.toLowerCase() === 'reactnative';\n};\n","import type { Observable } from 'rxjs';\nimport { useEffect, useState } from 'react';\nimport { RxUtils } from '@stream-io/video-client';\n\n/**\n * Utility hook which provides the current value of the given observable.\n *\n * @param observable$ the observable to read data from.\n * @param defaultValue a default value. Used when the observable data can't be read or emits an error.\n */\nexport const useObservableValue = <T>(\n observable$: Observable<T>,\n defaultValue?: T,\n) => {\n const [value, setValue] = useState<T>(() => {\n try {\n return RxUtils.getCurrentValue(observable$);\n } catch (err) {\n if (typeof defaultValue === 'undefined') throw err;\n return defaultValue;\n }\n });\n\n useEffect(() => {\n return RxUtils.createSubscription(observable$, setValue, (err) => {\n console.log('An error occurred while reading an observable', err);\n if (defaultValue) setValue(defaultValue);\n });\n }, [defaultValue, observable$]);\n\n return value;\n};\n","import {\n Call,\n CallClosedCaption,\n CallIngressResponse,\n CallSessionResponse,\n CallSettingsResponse,\n CallState,\n CallStatsReport,\n Comparator,\n EgressResponse,\n InputDeviceStatus,\n MemberResponse,\n OwnCapability,\n StreamVideoParticipant,\n UserResponse,\n} from '@stream-io/video-client';\nimport { useMemo, useState } from 'react';\nimport { Observable, of } from 'rxjs';\nimport { useCall } from '../contexts';\nimport { isReactNative } from '../helpers/platforms';\nimport { useObservableValue } from './useObservableValue';\n\n// kind-of memoized, used as a default value\nconst EMPTY_DEVICES_ARRAY = Object.freeze<MediaDeviceInfo[]>(\n [],\n) as MediaDeviceInfo[];\n\n/**\n * Utility hook, which provides the current call's state.\n */\nexport const useCallState = () => {\n const call = useCall();\n // return an empty and unlinked CallState object if there is no call in the provider\n // this ensures that the hooks always return a value and many null checks can be avoided\n if (!call) {\n const message =\n 'You are using useCallState() outside a Call context. ' +\n 'Please wrap your component in <StreamCall /> and provide a \"call\" instance.';\n console.warn(message);\n return new CallState();\n }\n return call.state;\n};\n\n/**\n * Utility hook which provides information whether the current call is being recorded. It will return `true` if the call is being recorded.\n */\nexport const useIsCallRecordingInProgress = (): boolean => {\n const { recording$ } = useCallState();\n return useObservableValue(recording$);\n};\n\n/**\n * Utility hook which provides information whether the current call is broadcasting.\n */\nexport const useIsCallHLSBroadcastingInProgress = (): boolean => {\n const { egress$ } = useCallState();\n const egress = useObservableValue(egress$);\n if (!egress) return false;\n return egress.broadcasting;\n};\n\n/**\n * Utility hook which provides information whether the current call is live.\n */\nexport const useIsCallLive = (): boolean => {\n const { backstage$ } = useCallState();\n const isBackstageOn = useObservableValue(backstage$);\n return !isBackstageOn;\n};\n\n/**\n * Returns the list of blocked users in the current call.\n */\nexport const useCallBlockedUserIds = (): string[] => {\n const { blockedUserIds$ } = useCallState();\n return useObservableValue(blockedUserIds$);\n};\n\n/**\n * Returns the timestamp when this call was created.\n */\nexport const useCallCreatedAt = (): Date | undefined => {\n const { createdAt$ } = useCallState();\n return useObservableValue(createdAt$);\n};\n\n/**\n * Returns the timestamp when this call was ended.\n */\nexport const useCallEndedAt = (): Date | undefined => {\n const { endedAt$ } = useCallState();\n return useObservableValue(endedAt$);\n};\n\n/**\n * Returns the timestamp telling when the call is scheduled to start.\n */\nexport const useCallStartsAt = (): Date | undefined => {\n const { startsAt$ } = useCallState();\n return useObservableValue(startsAt$);\n};\n\n/**\n * Returns the timestamp when this call was updated.\n */\nexport const useCallUpdatedAt = (): Date | undefined => {\n const { updatedAt$ } = useCallState();\n return useObservableValue(updatedAt$);\n};\n\n/**\n * Returns the information about the call's creator.\n */\nexport const useCallCreatedBy = (): UserResponse | undefined => {\n const { createdBy$ } = useCallState();\n return useObservableValue(createdBy$);\n};\n\n/**\n * Returns the call's custom data.\n */\nexport const useCallCustomData = (): Record<string, any> => {\n const { custom$ } = useCallState();\n return useObservableValue(custom$);\n};\n\n/**\n * Returns the call's Egress information.\n */\nexport const useCallEgress = (): EgressResponse | undefined => {\n const { egress$ } = useCallState();\n return useObservableValue(egress$);\n};\n\n/**\n * Returns the call's Ingress information.\n */\nexport const useCallIngress = (): CallIngressResponse | undefined => {\n const { ingress$ } = useCallState();\n return useObservableValue(ingress$);\n};\n\n/**\n * Returns the data for the current call session.\n */\nexport const useCallSession = (): CallSessionResponse | undefined => {\n const { session$ } = useCallState();\n return useObservableValue(session$);\n};\n\n/**\n * Returns the call's settings.\n */\nexport const useCallSettings = (): CallSettingsResponse | undefined => {\n const { settings$ } = useCallState();\n return useObservableValue(settings$);\n};\n\n/**\n * Returns whether the call has transcribing enabled.\n */\nexport const useIsCallTranscribingInProgress = (): boolean => {\n const { transcribing$ } = useCallState();\n return useObservableValue(transcribing$);\n};\n\n/**\n * Returns information about the user who has marked this call as ended.\n */\nexport const useCallEndedBy = (): UserResponse | undefined => {\n const { endedBy$ } = useCallState();\n return useObservableValue(endedBy$);\n};\n\n/**\n * Utility hook which provides a boolean indicating whether there is\n * a participant in the current call which shares their screen.\n */\nexport const useHasOngoingScreenShare = (): boolean => {\n const { hasOngoingScreenShare$ } = useCallState();\n return useObservableValue(hasOngoingScreenShare$);\n};\n\n/**\n * Utility hook which provides the latest stats report of the current call.\n *\n * The latest stats report of the current call.\n * When stats gathering is enabled, this observable will emit a new value\n * at a regular (configurable) interval.\n *\n * Consumers of this observable can implement their own batching logic\n * in case they want to show historical stats data.\n */\nexport const useCallStatsReport = (): CallStatsReport | undefined => {\n const { callStatsReport$ } = useCallState();\n return useObservableValue(callStatsReport$);\n};\n\n/**\n * Utility hook which provides the dominant speaker of the current call.\n */\nexport const useDominantSpeaker = (): StreamVideoParticipant | undefined => {\n const { dominantSpeaker$ } = useCallState();\n return useObservableValue(dominantSpeaker$);\n};\n\n/**\n * Utility hook which provides a list of call members.\n */\nexport const useCallMembers = (): MemberResponse[] => {\n const { members$ } = useCallState();\n return useObservableValue(members$);\n};\n\n/**\n * Utility hook providing the current calling state of the call. For example, `RINGING` or `JOINED`.\n */\nexport const useCallCallingState = () => {\n const { callingState$ } = useCallState();\n return useObservableValue(callingState$);\n};\n\n/**\n * Utility hook providing the actual start time of the current session.\n * Useful for calculating the call duration.\n */\nexport const useCallStartedAt = () => {\n const { startedAt$ } = useCallState();\n return useObservableValue(startedAt$);\n};\n\n/**\n * A hook which provides a list of all participants that have joined an active call.\n *\n * @param options.sortBy - A comparator function to sort the participants by.\n * Make sure to memoize output of the `combineComparators` function\n * (or keep it out of component's scope if possible) before passing it down to this property.\n */\nexport const useParticipants = ({\n sortBy,\n}: {\n /**\n * Make sure to memoize output of the `combineComparators` function\n * (or keep it out of component's scope if possible) before passing it down to this property.\n */\n sortBy?: Comparator<StreamVideoParticipant>;\n} = {}) => {\n const { participants$ } = useCallState();\n const participants = useObservableValue(participants$);\n\n return useMemo(() => {\n if (sortBy) {\n return [...participants].sort(sortBy);\n }\n return participants;\n }, [participants, sortBy]);\n};\n\n/**\n * A hook which provides a list of all participants that have joined an active call.\n * Unlike `useParticipants`, it returns a more stable reference that is not affected\n * by participant sort settings.\n *\n * @category Call State\n */\nexport const useRawParticipants = () => {\n const { rawParticipants$ } = useCallState();\n return useObservableValue(rawParticipants$);\n};\n\n/**\n * A hook which provides a StreamVideoLocalParticipant object.\n * It signals that I have joined a call.\n */\nexport const useLocalParticipant = () => {\n const { localParticipant$ } = useCallState();\n return useObservableValue(localParticipant$);\n};\n\n/**\n * A hook which provides a list of all other participants than me that have joined an active call.\n */\nexport const useRemoteParticipants = () => {\n const { remoteParticipants$ } = useCallState();\n return useObservableValue(remoteParticipants$);\n};\n\n/**\n * Returns the approximate participant count of the active call.\n * This includes the anonymous users as well, and it is computed on the server.\n */\nexport const useParticipantCount = () => {\n const { participantCount$ } = useCallState();\n return useObservableValue(participantCount$);\n};\n\n/**\n * Returns the approximate anonymous participant count of the active call.\n * The regular participants are not included in this count. It is computed on the server.\n */\nexport const useAnonymousParticipantCount = () => {\n const { anonymousParticipantCount$ } = useCallState();\n return useObservableValue(anonymousParticipantCount$);\n};\n\n/**\n * Returns the generated thumbnail of the current call, if enabled in settings.\n */\nexport const useCallThumbnail = () => {\n const { thumbnails$ } = useCallState();\n return useObservableValue(thumbnails$);\n};\n\n/**\n * A hook which returns the local participant's own capabilities.\n */\nexport const useOwnCapabilities = (): OwnCapability[] | undefined => {\n const { ownCapabilities$ } = useCallState();\n return useObservableValue(ownCapabilities$);\n};\n\n/**\n * Hook that returns true if the local participant has all the given permissions.\n *\n * @param permissions the permissions to check.\n */\nexport const useHasPermissions = (...permissions: OwnCapability[]): boolean => {\n const capabilities = useOwnCapabilities();\n return permissions.every((permission) => capabilities?.includes(permission));\n};\n\n/**\n * Returns the camera state of the current call.\n */\nexport const useCameraState = () => {\n const call = useCall();\n const { camera } = call as Call;\n\n const { state } = camera;\n const direction = useObservableValue(state.direction$);\n const mediaStream = useObservableValue(state.mediaStream$);\n const selectedDevice = useObservableValue(state.selectedDevice$);\n const { getDevices } = useLazyDeviceList(camera);\n const hasBrowserPermission = useObservableValue(state.hasBrowserPermission$);\n const isPromptingPermission = useObservableValue(\n state.isPromptingPermission$,\n );\n\n return {\n camera,\n direction,\n mediaStream,\n get devices() {\n return getDevices();\n },\n hasBrowserPermission,\n isPromptingPermission,\n selectedDevice,\n ...getComputedStatus(\n useObservableValue(state.status$),\n useObservableValue(state.optimisticStatus$),\n ),\n };\n};\n\n/**\n * Returns the microphone state of the current call.\n */\nexport const useMicrophoneState = () => {\n const call = useCall();\n const { microphone } = call as Call;\n\n const { state } = microphone;\n const mediaStream = useObservableValue(state.mediaStream$);\n const selectedDevice = useObservableValue(state.selectedDevice$);\n const { getDevices } = useLazyDeviceList(microphone);\n const hasBrowserPermission = useObservableValue(state.hasBrowserPermission$);\n const isPromptingPermission = useObservableValue(\n state.isPromptingPermission$,\n );\n const isSpeakingWhileMuted = useObservableValue(state.speakingWhileMuted$);\n\n return {\n microphone,\n mediaStream,\n get devices() {\n return getDevices();\n },\n selectedDevice,\n hasBrowserPermission,\n isPromptingPermission,\n isSpeakingWhileMuted,\n ...getComputedStatus(\n useObservableValue(state.status$),\n useObservableValue(state.optimisticStatus$),\n ),\n };\n};\n\n/**\n * Returns the speaker state of the current call.\n *\n * Note: This hook is not supported in React Native\n */\nexport const useSpeakerState = () => {\n if (isReactNative()) {\n throw new Error(\n 'This feature is not supported in React Native. Please visit https://getstream.io/video/docs/reactnative/core/camera-and-microphone/#speaker-management for more details',\n );\n }\n const call = useCall();\n const { speaker } = call as Call;\n\n const { getDevices } = useLazyDeviceList(speaker);\n const selectedDevice = useObservableValue(speaker.state.selectedDevice$);\n\n return {\n speaker,\n get devices() {\n return getDevices();\n },\n selectedDevice,\n isDeviceSelectionSupported: speaker.state.isDeviceSelectionSupported,\n };\n};\n\n/**\n * Returns the Screen Share state of the current call.\n */\nexport const useScreenShareState = () => {\n const call = useCall();\n const { screenShare } = call as Call;\n\n return {\n screenShare,\n mediaStream: useObservableValue(screenShare.state.mediaStream$),\n ...getComputedStatus(\n useObservableValue(screenShare.state.status$),\n useObservableValue(screenShare.state.optimisticStatus$),\n ),\n };\n};\n\n/**\n * Returns incoming video settings for the current call, including\n * global and per-participant manual video quality overrides.\n */\nexport const useIncomingVideoSettings = () => {\n const call = useCall() as Call;\n const settings = useObservableValue(\n call.dynascaleManager.incomingVideoSettings$,\n );\n return settings;\n};\n\n/**\n * Returns the current call's closed captions queue.\n */\nexport const useCallClosedCaptions = (): CallClosedCaption[] => {\n const { closedCaptions$ } = useCallState();\n return useObservableValue(closedCaptions$);\n};\n\n/**\n * Returns the current call's closed captions queue.\n */\nexport const useIsCallCaptioningInProgress = (): boolean => {\n const { captioning$ } = useCallState();\n return useObservableValue(captioning$);\n};\n\nfunction getComputedStatus(\n status: InputDeviceStatus,\n pendingStatus: InputDeviceStatus,\n) {\n const optimisticStatus = pendingStatus ?? status;\n\n return {\n status,\n optimisticStatus,\n isEnabled: status === 'enabled',\n isMute: status !== 'enabled',\n optimisticIsMute: optimisticStatus !== 'enabled',\n isTogglePending: optimisticStatus !== status,\n };\n}\n\ninterface DeviceManagerLike {\n listDevices(): Observable<MediaDeviceInfo[]>;\n}\n\nfunction useLazyDeviceList(manager: DeviceManagerLike) {\n const placeholderDevices$ = useMemo(() => of(EMPTY_DEVICES_ARRAY), []);\n const [devices$, setDevices$] = useState(placeholderDevices$);\n const devices = useObservableValue(devices$, EMPTY_DEVICES_ARRAY);\n\n const getDevices = () => {\n if (devices$ === placeholderDevices$) {\n setDevices$(manager.listDevices());\n }\n\n return devices;\n };\n\n return { getDevices };\n}\n","import { useStreamVideoClient } from '../contexts';\nimport { useObservableValue } from './useObservableValue';\n\n/**\n * Utility hook which provides access to client's state store.\n */\nexport const useStore = () => {\n const client = useStreamVideoClient();\n if (!client) {\n throw new Error(\n `StreamVideoClient isn't initialized or this hook is called outside of <StreamVideo> context.`,\n );\n }\n return client.state;\n};\n\n/**\n * Utility hook which provides a list of all notifications about created calls.\n * In the ring call settings, these calls can be outgoing (I have called somebody)\n * or incoming (somebody has called me).\n */\nexport const useCalls = () => {\n const { calls$ } = useStore();\n return useObservableValue(calls$);\n};\n\n/**\n * Returns the current connected user.\n */\nexport const useConnectedUser = () => {\n const { connectedUser$ } = useStore();\n return useObservableValue(connectedUser$);\n};\n","import { useCallback, useEffect, useState } from 'react';\nimport { useCall } from '../contexts';\nimport { useIsCallRecordingInProgress } from './callStateHooks';\n\n/**\n * Custom hook for toggling call recording in a video call.\n *\n * This hook provides functionality to start and stop call recording,\n * along with state management for tracking the recording status\n * and the loading indicator while awaiting a response.\n */\nexport const useToggleCallRecording = () => {\n const call = useCall();\n const isCallRecordingInProgress = useIsCallRecordingInProgress();\n const [isAwaitingResponse, setIsAwaitingResponse] = useState(false);\n\n // TODO: add permissions\n\n useEffect(() => {\n // we wait until call.recording_started/stopped event to flips the\n // `isCallRecordingInProgress` state variable.\n // Once the flip happens, we remove the loading indicator\n setIsAwaitingResponse((isAwaiting) => {\n if (isAwaiting) return false;\n return isAwaiting;\n });\n }, [isCallRecordingInProgress]);\n\n const toggleCallRecording = useCallback(async () => {\n try {\n setIsAwaitingResponse(true);\n if (isCallRecordingInProgress) {\n await call?.stopRecording();\n } else {\n await call?.startRecording();\n }\n } catch (e) {\n console.error(`Failed start recording`, e);\n throw e;\n }\n }, [call, isCallRecordingInProgress]);\n\n return { toggleCallRecording, isAwaitingResponse, isCallRecordingInProgress };\n};\n","import * as CallStateHooks from './callStateHooks';\n\nexport * from './useObservableValue';\n\nexport * from './store';\nexport * from './callUtilHooks';\n\n/**\n * A hook-alike function that exposes all call state hooks.\n */\nexport const useCallStateHooks = () => CallStateHooks;\n","import { OwnCapability } from '@stream-io/video-client';\n\nimport { PropsWithChildren } from 'react';\nimport { useCall } from '../contexts';\nimport { useCallStateHooks } from '../hooks';\n\ntype RestrictedProps = PropsWithChildren<{\n /**\n * Required grants for the component to be able to render supplied children elements\n */\n requiredGrants: OwnCapability[];\n /**\n * Render children only if user can request capability, but does not have it\n */\n canRequestOnly?: boolean;\n /**\n * Render children only if user has capability\n */\n hasPermissionsOnly?: boolean;\n /**\n * Require all grants specified in `requiredGrants` to be available in the `availableGrants`,\n * component by default requires only one grant to appear in both arrays to render its children\n */\n requireAll?: boolean;\n}>;\n\nexport const Restricted = ({\n canRequestOnly,\n hasPermissionsOnly,\n requiredGrants,\n requireAll = true,\n children,\n}: RestrictedProps) => {\n const call = useCall();\n const { useCallSettings, useOwnCapabilities } = useCallStateHooks();\n const ownCapabilities = useOwnCapabilities();\n const settings = useCallSettings();\n const hasPermissions = requiredGrants[requireAll ? 'every' : 'some'](\n (capability) => ownCapabilities?.includes(capability),\n );\n\n if (hasPermissionsOnly) return hasPermissions ? <>{children}</> : null;\n\n const canRequest = requiredGrants.some((capability) =>\n call?.permissionsContext.canRequest(capability, settings),\n );\n\n if (canRequestOnly) return canRequest ? <>{children}</> : null;\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EAAE,GAAG,iBAAiB,EAAE;AACnE,IAAA,MAAM,eAAe,GAAG,kBAAkB,EAAE;AAC5C,IAAA,MAAM,QAAQ,GAAG,eAAe,EAAE;IAClC,MAAM,cAAc,GAAG,cAAc,CAAC,UAAU,GAAG,OAAO,GAAG,MAAM,CAAC,CAClE,CAAC,UAAU,KAAK,eAAe,EAAE,QAAQ,CAAC,UAAU,CAAC,CACtD;AAED,IAAA,IAAI,kBAAkB;QAAE,OAAO,cAAc,GAAGA,GAAA,CAAAC,QAAA,EAAA,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAI,GAAG,IAAI;IAEtE,MAAM,UAAU,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC,UAAU,KAChD,IAAI,EAAE,kBAAkB,CAAC,UAAU,CAAC,UAAU,EAAE,QAAQ,CAAC,CAC1D;AAED,IAAA,IAAI,cAAc;QAAE,OAAO,UAAU,GAAGD,GAAA,CAAAC,QAAA,EAAA,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAI,GAAG,IAAI;IAE9D,IAAI,cAAc,IAAI,UAAU;QAAE,OAAOD,GAAA,CAAAC,QAAA,EAAA,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAI;AAExD,IAAA,OAAO,IAAI;AACb;;;;"}
|
|
1
|
+
{"version":3,"file":"index.es.js","sources":["../../src/contexts/StreamCallContext.tsx","../../src/i18n/StreamI18n.ts","../../src/contexts/StreamI18nContext.tsx","../../src/contexts/StreamVideoContext.tsx","../../src/helpers/platforms.ts","../../src/hooks/useObservableValue.ts","../../src/hooks/callStateHooks.ts","../../src/hooks/store.ts","../../src/hooks/callUtilHooks.ts","../../src/hooks/index.ts","../../src/wrappers/Restricted.tsx"],"sourcesContent":["import { createContext, PropsWithChildren, useContext } from 'react';\nimport { Call } from '@stream-io/video-client';\n\nconst StreamCallContext = createContext<Call | undefined>(undefined);\n\n/**\n * The props for the StreamCallProvider component.\n */\nexport interface StreamCallProviderProps {\n /**\n * The call instance to provide to the component tree.\n */\n call?: Call;\n}\n\n/**\n * A provider for the call object.\n */\nexport const StreamCallProvider = (\n props: PropsWithChildren<StreamCallProviderProps>,\n) => {\n const { call, children } = props;\n return (\n <StreamCallContext.Provider value={call}>\n {children}\n </StreamCallContext.Provider>\n );\n};\n\n/**\n * A hook to get the call object from the closest provider.\n */\nexport const useCall = () => {\n return useContext(StreamCallContext);\n};\n","import i18next from 'i18next';\nimport {\n TranslationLanguage,\n TranslationsMap,\n TranslationsRegistry,\n TranslatorFunction,\n} from './types';\n\nconst mapToRegistry = (translationsMap: TranslationsMap, namespace: string) =>\n Object.entries(translationsMap).reduce((acc, [lng, translations]) => {\n acc[lng] = { [namespace]: translations };\n return acc;\n }, {} as TranslationsRegistry);\n\nexport const defaultTranslationFunction = (key: string) => key;\n\nexport type StreamI18nConstructor = {\n /** Language into which the provided strings are translated */\n currentLanguage?: TranslationLanguage;\n /** Fallback language which will be used if no translation is found for current language */\n fallbackLanguage?: TranslationLanguage;\n /** Logs info level to console output. Helps find issues with loading not working. */\n debug?: boolean;\n /** Custom translations that will be merged with the defaults provided by the library. */\n translationsOverrides?: TranslationsMap;\n};\n\nexport class StreamI18n {\n /** Exposed i18n instance from the i18next library */\n i18nInstance;\n /** Translator function that converts the provided string into its equivalent in the current language. */\n t: TranslatorFunction = defaultTranslationFunction;\n\n constructor({\n debug = false,\n currentLanguage = 'en',\n fallbackLanguage,\n translationsOverrides = { en: {} },\n }: StreamI18nConstructor = {}) {\n const ns = 'stream-video';\n this.i18nInstance = i18next.createInstance({\n debug,\n defaultNS: ns,\n fallbackLng: fallbackLanguage,\n interpolation: { escapeValue: false },\n keySeparator: false,\n lng: currentLanguage,\n nsSeparator: false,\n parseMissingKeyHandler: defaultTranslationFunction,\n resources: mapToRegistry(translationsOverrides, ns),\n });\n }\n\n get currentLanguage() {\n return this.i18nInstance.language;\n }\n\n get isInitialized() {\n return this.i18nInstance.isInitialized;\n }\n\n init = async () => {\n this.t = await this.i18nInstance.init();\n return this.t;\n };\n\n changeLanguage = async (language?: TranslationLanguage) => {\n this.t = await this.i18nInstance.changeLanguage(language);\n return this.t;\n };\n}\n","import {\n createContext,\n PropsWithChildren,\n useContext,\n useEffect,\n useMemo,\n useState,\n} from 'react';\nimport {\n defaultTranslationFunction,\n StreamI18n,\n TranslationLanguage,\n TranslationsMap,\n} from '../i18n';\n\ntype StreamI18nContextValue = {\n t: StreamI18n['t'];\n i18n?: StreamI18n;\n};\n\nconst StreamI18nContext = createContext<StreamI18nContextValue>({\n t: defaultTranslationFunction,\n});\n\ntype CreateI18nParams = {\n i18nInstance?: StreamI18n;\n language?: TranslationLanguage;\n fallbackLanguage?: TranslationLanguage;\n translationsOverrides?: TranslationsMap;\n};\n\nexport type StreamI18nProviderProps = CreateI18nParams;\n\nexport const StreamI18nProvider = ({\n children,\n ...createI18nParams\n}: PropsWithChildren<StreamI18nProviderProps>) => {\n const api = useCreateI18n(createI18nParams);\n return (\n <StreamI18nContext.Provider value={api}>\n {children}\n </StreamI18nContext.Provider>\n );\n};\n\nconst useCreateI18n = ({\n i18nInstance,\n language,\n fallbackLanguage,\n translationsOverrides,\n}: CreateI18nParams) => {\n const [i18n] = useState(\n () =>\n i18nInstance ||\n new StreamI18n({\n currentLanguage: language,\n fallbackLanguage,\n translationsOverrides,\n }),\n );\n const [t, setTranslationFn] = useState<StreamI18n['t']>(() => i18n.t);\n useEffect(() => {\n if (!i18n.isInitialized) {\n i18n.init().then(() => setTranslationFn(() => i18n.t));\n } else if (i18n.currentLanguage !== language) {\n i18n.changeLanguage(language).then(() => setTranslationFn(() => i18n.t));\n }\n }, [i18n, language]);\n\n return useMemo(() => ({ i18n, t }), [i18n, t]);\n};\n\n/**\n * A hook to get the i18n instance and translation function from the closest provider.\n *\n * Example usage:\n * const { t, i18n } = useI18n();\n * const message = t('hello_world');\n * console.log(message);\n */\nexport const useI18n = () => useContext(StreamI18nContext);\n","import { createContext, PropsWithChildren, useContext } from 'react';\nimport { StreamVideoClient } from '@stream-io/video-client';\nimport {\n StreamI18nProvider,\n StreamI18nProviderProps,\n} from './StreamI18nContext';\n\nconst StreamVideoContext = createContext<StreamVideoClient | undefined>(\n undefined,\n);\n\n/**\n * The props for the StreamVideoProvider component.\n */\nexport type StreamVideoProps = StreamI18nProviderProps & {\n /**\n * The client instance to provide to the component tree.\n */\n client: StreamVideoClient;\n};\n\n/**\n * StreamVideo is a provider component which should be used to wrap the entire application.\n * It provides the client object to all children components and initializes the i18n instance.\n */\nexport const StreamVideoProvider = ({\n children,\n client,\n i18nInstance,\n language,\n translationsOverrides,\n}: PropsWithChildren<StreamVideoProps>) => {\n return (\n <StreamVideoContext.Provider value={client}>\n <StreamI18nProvider\n i18nInstance={i18nInstance}\n language={language}\n translationsOverrides={translationsOverrides}\n >\n {children}\n </StreamI18nProvider>\n </StreamVideoContext.Provider>\n );\n};\n\n/**\n * Hook to access the nearest StreamVideo client instance.\n */\nexport const useStreamVideoClient = () => {\n return useContext(StreamVideoContext);\n};\n","/**\n * Checks whether we are using React Native\n */\nexport const isReactNative = () => {\n if (typeof navigator === 'undefined') return false;\n return navigator.product?.toLowerCase() === 'reactnative';\n};\n","import type { Observable } from 'rxjs';\nimport { useEffect, useState } from 'react';\nimport { RxUtils } from '@stream-io/video-client';\n\n/**\n * Utility hook which provides the current value of the given observable.\n *\n * @param observable$ the observable to read data from.\n * @param defaultValue a default value. Used when the observable data can't be read or emits an error.\n */\nexport const useObservableValue = <T>(\n observable$: Observable<T>,\n defaultValue?: T,\n) => {\n const [value, setValue] = useState<T>(() => {\n try {\n return RxUtils.getCurrentValue(observable$);\n } catch (err) {\n if (typeof defaultValue === 'undefined') throw err;\n return defaultValue;\n }\n });\n\n useEffect(() => {\n return RxUtils.createSubscription(observable$, setValue, (err) => {\n console.log('An error occurred while reading an observable', err);\n if (defaultValue) setValue(defaultValue);\n });\n }, [defaultValue, observable$]);\n\n return value;\n};\n","import {\n Call,\n CallClosedCaption,\n CallIngressResponse,\n CallSessionResponse,\n CallSettingsResponse,\n CallState,\n CallStatsReport,\n Comparator,\n EgressResponse,\n InputDeviceStatus,\n MemberResponse,\n OwnCapability,\n StreamVideoParticipant,\n UserResponse,\n} from '@stream-io/video-client';\nimport { useMemo, useState } from 'react';\nimport { Observable, of } from 'rxjs';\nimport { useCall } from '../contexts';\nimport { isReactNative } from '../helpers/platforms';\nimport { useObservableValue } from './useObservableValue';\n\n// kind-of memoized, used as a default value\nconst EMPTY_DEVICES_ARRAY = Object.freeze<MediaDeviceInfo[]>(\n [],\n) as MediaDeviceInfo[];\n\nexport type UseInputMediaDeviceOptions = {\n /**\n * If `true`, the hook will use the optimistic status to determine whether the device is muted or not.\n */\n optimisticUpdates?: boolean;\n};\n\n/**\n * Utility hook, which provides the current call's state.\n */\nexport const useCallState = () => {\n const call = useCall();\n // return an empty and unlinked CallState object if there is no call in the provider\n // this ensures that the hooks always return a value and many null checks can be avoided\n if (!call) {\n const message =\n 'You are using useCallState() outside a Call context. ' +\n 'Please wrap your component in <StreamCall /> and provide a \"call\" instance.';\n console.warn(message);\n return new CallState();\n }\n return call.state;\n};\n\n/**\n * Utility hook which provides information whether the current call is being recorded. It will return `true` if the call is being recorded.\n */\nexport const useIsCallRecordingInProgress = (): boolean => {\n const { recording$ } = useCallState();\n return useObservableValue(recording$);\n};\n\n/**\n * Utility hook which provides information whether the current call is broadcasting.\n */\nexport const useIsCallHLSBroadcastingInProgress = (): boolean => {\n const { egress$ } = useCallState();\n const egress = useObservableValue(egress$);\n if (!egress) return false;\n return egress.broadcasting;\n};\n\n/**\n * Utility hook which provides information whether the current call is live.\n */\nexport const useIsCallLive = (): boolean => {\n const { backstage$ } = useCallState();\n const isBackstageOn = useObservableValue(backstage$);\n return !isBackstageOn;\n};\n\n/**\n * Returns the list of blocked users in the current call.\n */\nexport const useCallBlockedUserIds = (): string[] => {\n const { blockedUserIds$ } = useCallState();\n return useObservableValue(blockedUserIds$);\n};\n\n/**\n * Returns the timestamp when this call was created.\n */\nexport const useCallCreatedAt = (): Date | undefined => {\n const { createdAt$ } = useCallState();\n return useObservableValue(createdAt$);\n};\n\n/**\n * Returns the timestamp when this call was ended.\n */\nexport const useCallEndedAt = (): Date | undefined => {\n const { endedAt$ } = useCallState();\n return useObservableValue(endedAt$);\n};\n\n/**\n * Returns the timestamp telling when the call is scheduled to start.\n */\nexport const useCallStartsAt = (): Date | undefined => {\n const { startsAt$ } = useCallState();\n return useObservableValue(startsAt$);\n};\n\n/**\n * Returns the timestamp when this call was updated.\n */\nexport const useCallUpdatedAt = (): Date | undefined => {\n const { updatedAt$ } = useCallState();\n return useObservableValue(updatedAt$);\n};\n\n/**\n * Returns the information about the call's creator.\n */\nexport const useCallCreatedBy = (): UserResponse | undefined => {\n const { createdBy$ } = useCallState();\n return useObservableValue(createdBy$);\n};\n\n/**\n * Returns the call's custom data.\n */\nexport const useCallCustomData = (): Record<string, any> => {\n const { custom$ } = useCallState();\n return useObservableValue(custom$);\n};\n\n/**\n * Returns the call's Egress information.\n */\nexport const useCallEgress = (): EgressResponse | undefined => {\n const { egress$ } = useCallState();\n return useObservableValue(egress$);\n};\n\n/**\n * Returns the call's Ingress information.\n */\nexport const useCallIngress = (): CallIngressResponse | undefined => {\n const { ingress$ } = useCallState();\n return useObservableValue(ingress$);\n};\n\n/**\n * Returns the data for the current call session.\n */\nexport const useCallSession = (): CallSessionResponse | undefined => {\n const { session$ } = useCallState();\n return useObservableValue(session$);\n};\n\n/**\n * Returns the call's settings.\n */\nexport const useCallSettings = (): CallSettingsResponse | undefined => {\n const { settings$ } = useCallState();\n return useObservableValue(settings$);\n};\n\n/**\n * Returns whether the call has transcribing enabled.\n */\nexport const useIsCallTranscribingInProgress = (): boolean => {\n const { transcribing$ } = useCallState();\n return useObservableValue(transcribing$);\n};\n\n/**\n * Returns information about the user who has marked this call as ended.\n */\nexport const useCallEndedBy = (): UserResponse | undefined => {\n const { endedBy$ } = useCallState();\n return useObservableValue(endedBy$);\n};\n\n/**\n * Utility hook which provides a boolean indicating whether there is\n * a participant in the current call which shares their screen.\n */\nexport const useHasOngoingScreenShare = (): boolean => {\n const { hasOngoingScreenShare$ } = useCallState();\n return useObservableValue(hasOngoingScreenShare$);\n};\n\n/**\n * Utility hook which provides the latest stats report of the current call.\n *\n * The latest stats report of the current call.\n * When stats gathering is enabled, this observable will emit a new value\n * at a regular (configurable) interval.\n *\n * Consumers of this observable can implement their own batching logic\n * in case they want to show historical stats data.\n */\nexport const useCallStatsReport = (): CallStatsReport | undefined => {\n const { callStatsReport$ } = useCallState();\n return useObservableValue(callStatsReport$);\n};\n\n/**\n * Utility hook which provides the dominant speaker of the current call.\n */\nexport const useDominantSpeaker = (): StreamVideoParticipant | undefined => {\n const { dominantSpeaker$ } = useCallState();\n return useObservableValue(dominantSpeaker$);\n};\n\n/**\n * Utility hook which provides a list of call members.\n */\nexport const useCallMembers = (): MemberResponse[] => {\n const { members$ } = useCallState();\n return useObservableValue(members$);\n};\n\n/**\n * Utility hook providing the current calling state of the call. For example, `RINGING` or `JOINED`.\n */\nexport const useCallCallingState = () => {\n const { callingState$ } = useCallState();\n return useObservableValue(callingState$);\n};\n\n/**\n * Utility hook providing the actual start time of the current session.\n * Useful for calculating the call duration.\n */\nexport const useCallStartedAt = () => {\n const { startedAt$ } = useCallState();\n return useObservableValue(startedAt$);\n};\n\n/**\n * A hook which provides a list of all participants that have joined an active call.\n *\n * @param options.sortBy - A comparator function to sort the participants by.\n * Make sure to memoize output of the `combineComparators` function\n * (or keep it out of component's scope if possible) before passing it down to this property.\n */\nexport const useParticipants = ({\n sortBy,\n}: {\n /**\n * Make sure to memoize output of the `combineComparators` function\n * (or keep it out of component's scope if possible) before passing it down to this property.\n */\n sortBy?: Comparator<StreamVideoParticipant>;\n} = {}) => {\n const { participants$ } = useCallState();\n const participants = useObservableValue(participants$);\n\n return useMemo(() => {\n if (sortBy) {\n return [...participants].sort(sortBy);\n }\n return participants;\n }, [participants, sortBy]);\n};\n\n/**\n * A hook which provides a list of all participants that have joined an active call.\n * Unlike `useParticipants`, it returns a more stable reference that is not affected\n * by participant sort settings.\n *\n * @category Call State\n */\nexport const useRawParticipants = () => {\n const { rawParticipants$ } = useCallState();\n return useObservableValue(rawParticipants$);\n};\n\n/**\n * A hook which provides a StreamVideoLocalParticipant object.\n * It signals that I have joined a call.\n */\nexport const useLocalParticipant = () => {\n const { localParticipant$ } = useCallState();\n return useObservableValue(localParticipant$);\n};\n\n/**\n * A hook which provides a list of all other participants than me that have joined an active call.\n */\nexport const useRemoteParticipants = () => {\n const { remoteParticipants$ } = useCallState();\n return useObservableValue(remoteParticipants$);\n};\n\n/**\n * Returns the approximate participant count of the active call.\n * This includes the anonymous users as well, and it is computed on the server.\n */\nexport const useParticipantCount = () => {\n const { participantCount$ } = useCallState();\n return useObservableValue(participantCount$);\n};\n\n/**\n * Returns the approximate anonymous participant count of the active call.\n * The regular participants are not included in this count. It is computed on the server.\n */\nexport const useAnonymousParticipantCount = () => {\n const { anonymousParticipantCount$ } = useCallState();\n return useObservableValue(anonymousParticipantCount$);\n};\n\n/**\n * Returns the generated thumbnail of the current call, if enabled in settings.\n */\nexport const useCallThumbnail = () => {\n const { thumbnails$ } = useCallState();\n return useObservableValue(thumbnails$);\n};\n\n/**\n * A hook which returns the local participant's own capabilities.\n */\nexport const useOwnCapabilities = (): OwnCapability[] | undefined => {\n const { ownCapabilities$ } = useCallState();\n return useObservableValue(ownCapabilities$);\n};\n\n/**\n * Hook that returns true if the local participant has all the given permissions.\n *\n * @param permissions the permissions to check.\n */\nexport const useHasPermissions = (...permissions: OwnCapability[]): boolean => {\n const capabilities = useOwnCapabilities();\n return permissions.every((permission) => capabilities?.includes(permission));\n};\n\n/**\n * Returns the camera state of the current call.\n */\nexport const useCameraState = ({\n optimisticUpdates = true,\n}: UseInputMediaDeviceOptions = {}) => {\n const call = useCall();\n const { camera } = call as Call;\n\n const { state } = camera;\n const direction = useObservableValue(state.direction$);\n const mediaStream = useObservableValue(state.mediaStream$);\n const selectedDevice = useObservableValue(state.selectedDevice$);\n const { getDevices } = useLazyDeviceList(camera);\n const hasBrowserPermission = useObservableValue(state.hasBrowserPermission$);\n const isPromptingPermission = useObservableValue(\n state.isPromptingPermission$,\n );\n\n return {\n camera,\n direction,\n mediaStream,\n get devices() {\n return getDevices();\n },\n hasBrowserPermission,\n isPromptingPermission,\n selectedDevice,\n ...getComputedStatus(\n useObservableValue(state.status$),\n useObservableValue(state.optimisticStatus$),\n { optimisticUpdates },\n ),\n };\n};\n\n/**\n * Returns the microphone state of the current call.\n */\nexport const useMicrophoneState = ({\n optimisticUpdates = true,\n}: UseInputMediaDeviceOptions = {}) => {\n const call = useCall();\n const { microphone } = call as Call;\n\n const { state } = microphone;\n const mediaStream = useObservableValue(state.mediaStream$);\n const selectedDevice = useObservableValue(state.selectedDevice$);\n const { getDevices } = useLazyDeviceList(microphone);\n const hasBrowserPermission = useObservableValue(state.hasBrowserPermission$);\n const isPromptingPermission = useObservableValue(\n state.isPromptingPermission$,\n );\n const isSpeakingWhileMuted = useObservableValue(state.speakingWhileMuted$);\n\n return {\n microphone,\n mediaStream,\n get devices() {\n return getDevices();\n },\n selectedDevice,\n hasBrowserPermission,\n isPromptingPermission,\n isSpeakingWhileMuted,\n ...getComputedStatus(\n useObservableValue(state.status$),\n useObservableValue(state.optimisticStatus$),\n { optimisticUpdates },\n ),\n };\n};\n\n/**\n * Returns the speaker state of the current call.\n *\n * Note: This hook is not supported in React Native\n */\nexport const useSpeakerState = () => {\n if (isReactNative()) {\n throw new Error(\n 'This feature is not supported in React Native. Please visit https://getstream.io/video/docs/reactnative/core/camera-and-microphone/#speaker-management for more details',\n );\n }\n const call = useCall();\n const { speaker } = call as Call;\n\n const { getDevices } = useLazyDeviceList(speaker);\n const selectedDevice = useObservableValue(speaker.state.selectedDevice$);\n\n return {\n speaker,\n get devices() {\n return getDevices();\n },\n selectedDevice,\n isDeviceSelectionSupported: speaker.state.isDeviceSelectionSupported,\n };\n};\n\n/**\n * Returns the Screen Share state of the current call.\n */\nexport const useScreenShareState = ({\n optimisticUpdates = true,\n}: UseInputMediaDeviceOptions = {}) => {\n const call = useCall();\n const { screenShare } = call as Call;\n\n return {\n screenShare,\n mediaStream: useObservableValue(screenShare.state.mediaStream$),\n ...getComputedStatus(\n useObservableValue(screenShare.state.status$),\n useObservableValue(screenShare.state.optimisticStatus$),\n { optimisticUpdates },\n ),\n };\n};\n\n/**\n * Returns incoming video settings for the current call, including\n * global and per-participant manual video quality overrides.\n */\nexport const useIncomingVideoSettings = () => {\n const call = useCall() as Call;\n const settings = useObservableValue(\n call.dynascaleManager.incomingVideoSettings$,\n );\n return settings;\n};\n\n/**\n * Returns the current call's closed captions queue.\n */\nexport const useCallClosedCaptions = (): CallClosedCaption[] => {\n const { closedCaptions$ } = useCallState();\n return useObservableValue(closedCaptions$);\n};\n\n/**\n * Returns the current call's closed captions queue.\n */\nexport const useIsCallCaptioningInProgress = (): boolean => {\n const { captioning$ } = useCallState();\n return useObservableValue(captioning$);\n};\n\nfunction getComputedStatus(\n status: InputDeviceStatus,\n pendingStatus: InputDeviceStatus,\n options: Required<UseInputMediaDeviceOptions>,\n) {\n const optimisticStatus = pendingStatus ?? status;\n\n return {\n status,\n optimisticStatus,\n isEnabled: status === 'enabled',\n isMute: status !== 'enabled',\n optimisticIsMute: optimisticStatus !== 'enabled',\n isTogglePending: optimisticStatus !== status,\n /**\n * If optimistic updates are enabled (`options.optimisticUpdates`), we\n * consider the optimistic status to determine whether the device is muted or not.\n * Otherwise, we rely on the actual status.\n */\n optionsAwareIsMute: options.optimisticUpdates\n ? optimisticStatus !== 'enabled'\n : status !== 'enabled',\n };\n}\n\ninterface DeviceManagerLike {\n listDevices(): Observable<MediaDeviceInfo[]>;\n}\n\nfunction useLazyDeviceList(manager: DeviceManagerLike) {\n const placeholderDevices$ = useMemo(() => of(EMPTY_DEVICES_ARRAY), []);\n const [devices$, setDevices$] = useState(placeholderDevices$);\n const devices = useObservableValue(devices$, EMPTY_DEVICES_ARRAY);\n\n const getDevices = () => {\n if (devices$ === placeholderDevices$) {\n setDevices$(manager.listDevices());\n }\n\n return devices;\n };\n\n return { getDevices };\n}\n","import { useStreamVideoClient } from '../contexts';\nimport { useObservableValue } from './useObservableValue';\n\n/**\n * Utility hook which provides access to client's state store.\n */\nexport const useStore = () => {\n const client = useStreamVideoClient();\n if (!client) {\n throw new Error(\n `StreamVideoClient isn't initialized or this hook is called outside of <StreamVideo> context.`,\n );\n }\n return client.state;\n};\n\n/**\n * Utility hook which provides a list of all notifications about created calls.\n * In the ring call settings, these calls can be outgoing (I have called somebody)\n * or incoming (somebody has called me).\n */\nexport const useCalls = () => {\n const { calls$ } = useStore();\n return useObservableValue(calls$);\n};\n\n/**\n * Returns the current connected user.\n */\nexport const useConnectedUser = () => {\n const { connectedUser$ } = useStore();\n return useObservableValue(connectedUser$);\n};\n","import { useCallback, useEffect, useState } from 'react';\nimport { useCall } from '../contexts';\nimport { useIsCallRecordingInProgress } from './callStateHooks';\n\n/**\n * Custom hook for toggling call recording in a video call.\n *\n * This hook provides functionality to start and stop call recording,\n * along with state management for tracking the recording status\n * and the loading indicator while awaiting a response.\n */\nexport const useToggleCallRecording = () => {\n const call = useCall();\n const isCallRecordingInProgress = useIsCallRecordingInProgress();\n const [isAwaitingResponse, setIsAwaitingResponse] = useState(false);\n\n // TODO: add permissions\n\n useEffect(() => {\n // we wait until call.recording_started/stopped event to flips the\n // `isCallRecordingInProgress` state variable.\n // Once the flip happens, we remove the loading indicator\n setIsAwaitingResponse((isAwaiting) => {\n if (isAwaiting) return false;\n return isAwaiting;\n });\n }, [isCallRecordingInProgress]);\n\n const toggleCallRecording = useCallback(async () => {\n try {\n setIsAwaitingResponse(true);\n if (isCallRecordingInProgress) {\n await call?.stopRecording();\n } else {\n await call?.startRecording();\n }\n } catch (e) {\n console.error(`Failed start recording`, e);\n throw e;\n }\n }, [call, isCallRecordingInProgress]);\n\n return { toggleCallRecording, isAwaitingResponse, isCallRecordingInProgress };\n};\n","import * as CallStateHooks from './callStateHooks';\n\nexport * from './useObservableValue';\n\nexport * from './store';\nexport * from './callUtilHooks';\n\nexport type { UseInputMediaDeviceOptions } from './callStateHooks';\n\n/**\n * A hook-alike function that exposes all call state hooks.\n */\nexport const useCallStateHooks = () => CallStateHooks;\n","import { OwnCapability } from '@stream-io/video-client';\n\nimport { PropsWithChildren } from 'react';\nimport { useCall } from '../contexts';\nimport { useCallStateHooks } from '../hooks';\n\ntype RestrictedProps = PropsWithChildren<{\n /**\n * Required grants for the component to be able to render supplied children elements\n */\n requiredGrants: OwnCapability[];\n /**\n * Render children only if user can request capability, but does not have it\n */\n canRequestOnly?: boolean;\n /**\n * Render children only if user has capability\n */\n hasPermissionsOnly?: boolean;\n /**\n * Require all grants specified in `requiredGrants` to be available in the `availableGrants`,\n * component by default requires only one grant to appear in both arrays to render its children\n */\n requireAll?: boolean;\n}>;\n\nexport const Restricted = ({\n canRequestOnly,\n hasPermissionsOnly,\n requiredGrants,\n requireAll = true,\n children,\n}: RestrictedProps) => {\n const call = useCall();\n const { useCallSettings, useOwnCapabilities } = useCallStateHooks();\n const ownCapabilities = useOwnCapabilities();\n const settings = useCallSettings();\n const hasPermissions = requiredGrants[requireAll ? 'every' : 'some'](\n (capability) => ownCapabilities?.includes(capability),\n );\n\n if (hasPermissionsOnly) return hasPermissions ? <>{children}</> : null;\n\n const canRequest = requiredGrants.some((capability) =>\n call?.permissionsContext.canRequest(capability, settings),\n );\n\n if (canRequestOnly) return canRequest ? <>{children}</> : null;\n\n if (hasPermissions || canRequest) return <>{children}</>;\n\n return null;\n};\n"],"names":["_jsx","_Fragment"],"mappings":";;;;;;AAGA,MAAM,iBAAiB,GAAG,aAAa,CAAmB,SAAS,CAAC;AAYpE;;AAEG;AACU,MAAA,kBAAkB,GAAG,CAChC,KAAiD,KAC/C;AACF,IAAA,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,KAAK;AAChC,IAAA,QACEA,GAAA,CAAC,iBAAiB,CAAC,QAAQ,EAAA,EAAC,KAA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kB,EAAE,GAAG,iBAAiB,EAAE;AACnE,IAAA,MAAM,eAAe,GAAG,kBAAkB,EAAE;AAC5C,IAAA,MAAM,QAAQ,GAAG,eAAe,EAAE;IAClC,MAAM,cAAc,GAAG,cAAc,CAAC,UAAU,GAAG,OAAO,GAAG,MAAM,CAAC,CAClE,CAAC,UAAU,KAAK,eAAe,EAAE,QAAQ,CAAC,UAAU,CAAC,CACtD;AAED,IAAA,IAAI,kBAAkB;QAAE,OAAO,cAAc,GAAGA,GAAA,CAAAC,QAAA,EAAA,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAI,GAAG,IAAI;IAEtE,MAAM,UAAU,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC,UAAU,KAChD,IAAI,EAAE,kBAAkB,CAAC,UAAU,CAAC,UAAU,EAAE,QAAQ,CAAC,CAC1D;AAED,IAAA,IAAI,cAAc;QAAE,OAAO,UAAU,GAAGD,GAAA,CAAAC,QAAA,EAAA,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAI,GAAG,IAAI;IAE9D,IAAI,cAAc,IAAI,UAAU;QAAE,OAAOD,GAAA,CAAAC,QAAA,EAAA,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAI;AAExD,IAAA,OAAO,IAAI;AACb;;;;"}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { CallClosedCaption, CallIngressResponse, CallSessionResponse, CallSettingsResponse, CallState, CallStatsReport, Comparator, EgressResponse, InputDeviceStatus, MemberResponse, OwnCapability, StreamVideoParticipant, UserResponse } from '@stream-io/video-client';
|
|
2
|
+
export type UseInputMediaDeviceOptions = {
|
|
3
|
+
/**
|
|
4
|
+
* If `true`, the hook will use the optimistic status to determine whether the device is muted or not.
|
|
5
|
+
*/
|
|
6
|
+
optimisticUpdates?: boolean;
|
|
7
|
+
};
|
|
2
8
|
/**
|
|
3
9
|
* Utility hook, which provides the current call's state.
|
|
4
10
|
*/
|
|
@@ -158,13 +164,19 @@ export declare const useHasPermissions: (...permissions: OwnCapability[]) => boo
|
|
|
158
164
|
/**
|
|
159
165
|
* Returns the camera state of the current call.
|
|
160
166
|
*/
|
|
161
|
-
export declare const useCameraState: () => {
|
|
167
|
+
export declare const useCameraState: ({ optimisticUpdates, }?: UseInputMediaDeviceOptions) => {
|
|
162
168
|
status: InputDeviceStatus;
|
|
163
169
|
optimisticStatus: InputDeviceStatus;
|
|
164
170
|
isEnabled: boolean;
|
|
165
171
|
isMute: boolean;
|
|
166
172
|
optimisticIsMute: boolean;
|
|
167
173
|
isTogglePending: boolean;
|
|
174
|
+
/**
|
|
175
|
+
* If optimistic updates are enabled (`options.optimisticUpdates`), we
|
|
176
|
+
* consider the optimistic status to determine whether the device is muted or not.
|
|
177
|
+
* Otherwise, we rely on the actual status.
|
|
178
|
+
*/
|
|
179
|
+
optionsAwareIsMute: boolean;
|
|
168
180
|
camera: import("@stream-io/video-client").CameraManager;
|
|
169
181
|
direction: import("@stream-io/video-client").CameraDirection;
|
|
170
182
|
mediaStream: MediaStream | undefined;
|
|
@@ -176,13 +188,19 @@ export declare const useCameraState: () => {
|
|
|
176
188
|
/**
|
|
177
189
|
* Returns the microphone state of the current call.
|
|
178
190
|
*/
|
|
179
|
-
export declare const useMicrophoneState: () => {
|
|
191
|
+
export declare const useMicrophoneState: ({ optimisticUpdates, }?: UseInputMediaDeviceOptions) => {
|
|
180
192
|
status: InputDeviceStatus;
|
|
181
193
|
optimisticStatus: InputDeviceStatus;
|
|
182
194
|
isEnabled: boolean;
|
|
183
195
|
isMute: boolean;
|
|
184
196
|
optimisticIsMute: boolean;
|
|
185
197
|
isTogglePending: boolean;
|
|
198
|
+
/**
|
|
199
|
+
* If optimistic updates are enabled (`options.optimisticUpdates`), we
|
|
200
|
+
* consider the optimistic status to determine whether the device is muted or not.
|
|
201
|
+
* Otherwise, we rely on the actual status.
|
|
202
|
+
*/
|
|
203
|
+
optionsAwareIsMute: boolean;
|
|
186
204
|
microphone: import("@stream-io/video-client").MicrophoneManager;
|
|
187
205
|
mediaStream: MediaStream | undefined;
|
|
188
206
|
devices: MediaDeviceInfo[];
|
|
@@ -205,13 +223,19 @@ export declare const useSpeakerState: () => {
|
|
|
205
223
|
/**
|
|
206
224
|
* Returns the Screen Share state of the current call.
|
|
207
225
|
*/
|
|
208
|
-
export declare const useScreenShareState: () => {
|
|
226
|
+
export declare const useScreenShareState: ({ optimisticUpdates, }?: UseInputMediaDeviceOptions) => {
|
|
209
227
|
status: InputDeviceStatus;
|
|
210
228
|
optimisticStatus: InputDeviceStatus;
|
|
211
229
|
isEnabled: boolean;
|
|
212
230
|
isMute: boolean;
|
|
213
231
|
optimisticIsMute: boolean;
|
|
214
232
|
isTogglePending: boolean;
|
|
233
|
+
/**
|
|
234
|
+
* If optimistic updates are enabled (`options.optimisticUpdates`), we
|
|
235
|
+
* consider the optimistic status to determine whether the device is muted or not.
|
|
236
|
+
* Otherwise, we rely on the actual status.
|
|
237
|
+
*/
|
|
238
|
+
optionsAwareIsMute: boolean;
|
|
215
239
|
screenShare: import("@stream-io/video-client").ScreenShareManager;
|
|
216
240
|
mediaStream: MediaStream | undefined;
|
|
217
241
|
};
|
|
@@ -2,6 +2,7 @@ import * as CallStateHooks from './callStateHooks';
|
|
|
2
2
|
export * from './useObservableValue';
|
|
3
3
|
export * from './store';
|
|
4
4
|
export * from './callUtilHooks';
|
|
5
|
+
export type { UseInputMediaDeviceOptions } from './callStateHooks';
|
|
5
6
|
/**
|
|
6
7
|
* A hook-alike function that exposes all call state hooks.
|
|
7
8
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stream-io/video-react-bindings",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.1",
|
|
4
4
|
"main": "./dist/index.cjs.js",
|
|
5
5
|
"module": "./dist/index.es.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -25,12 +25,12 @@
|
|
|
25
25
|
"rxjs": "~7.8.1"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"@stream-io/video-client": "^1.
|
|
28
|
+
"@stream-io/video-client": "^1.30.0",
|
|
29
29
|
"react": "^17 || ^18 || ^19"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@rollup/plugin-typescript": "^12.1.2",
|
|
33
|
-
"@stream-io/video-client": "^1.
|
|
33
|
+
"@stream-io/video-client": "^1.30.0",
|
|
34
34
|
"@types/react": "^19.1.3",
|
|
35
35
|
"react": "19.0.0",
|
|
36
36
|
"rimraf": "^6.0.1",
|
|
@@ -25,6 +25,13 @@ const EMPTY_DEVICES_ARRAY = Object.freeze<MediaDeviceInfo[]>(
|
|
|
25
25
|
[],
|
|
26
26
|
) as MediaDeviceInfo[];
|
|
27
27
|
|
|
28
|
+
export type UseInputMediaDeviceOptions = {
|
|
29
|
+
/**
|
|
30
|
+
* If `true`, the hook will use the optimistic status to determine whether the device is muted or not.
|
|
31
|
+
*/
|
|
32
|
+
optimisticUpdates?: boolean;
|
|
33
|
+
};
|
|
34
|
+
|
|
28
35
|
/**
|
|
29
36
|
* Utility hook, which provides the current call's state.
|
|
30
37
|
*/
|
|
@@ -333,7 +340,9 @@ export const useHasPermissions = (...permissions: OwnCapability[]): boolean => {
|
|
|
333
340
|
/**
|
|
334
341
|
* Returns the camera state of the current call.
|
|
335
342
|
*/
|
|
336
|
-
export const useCameraState = (
|
|
343
|
+
export const useCameraState = ({
|
|
344
|
+
optimisticUpdates = true,
|
|
345
|
+
}: UseInputMediaDeviceOptions = {}) => {
|
|
337
346
|
const call = useCall();
|
|
338
347
|
const { camera } = call as Call;
|
|
339
348
|
|
|
@@ -360,6 +369,7 @@ export const useCameraState = () => {
|
|
|
360
369
|
...getComputedStatus(
|
|
361
370
|
useObservableValue(state.status$),
|
|
362
371
|
useObservableValue(state.optimisticStatus$),
|
|
372
|
+
{ optimisticUpdates },
|
|
363
373
|
),
|
|
364
374
|
};
|
|
365
375
|
};
|
|
@@ -367,7 +377,9 @@ export const useCameraState = () => {
|
|
|
367
377
|
/**
|
|
368
378
|
* Returns the microphone state of the current call.
|
|
369
379
|
*/
|
|
370
|
-
export const useMicrophoneState = (
|
|
380
|
+
export const useMicrophoneState = ({
|
|
381
|
+
optimisticUpdates = true,
|
|
382
|
+
}: UseInputMediaDeviceOptions = {}) => {
|
|
371
383
|
const call = useCall();
|
|
372
384
|
const { microphone } = call as Call;
|
|
373
385
|
|
|
@@ -394,6 +406,7 @@ export const useMicrophoneState = () => {
|
|
|
394
406
|
...getComputedStatus(
|
|
395
407
|
useObservableValue(state.status$),
|
|
396
408
|
useObservableValue(state.optimisticStatus$),
|
|
409
|
+
{ optimisticUpdates },
|
|
397
410
|
),
|
|
398
411
|
};
|
|
399
412
|
};
|
|
@@ -428,7 +441,9 @@ export const useSpeakerState = () => {
|
|
|
428
441
|
/**
|
|
429
442
|
* Returns the Screen Share state of the current call.
|
|
430
443
|
*/
|
|
431
|
-
export const useScreenShareState = (
|
|
444
|
+
export const useScreenShareState = ({
|
|
445
|
+
optimisticUpdates = true,
|
|
446
|
+
}: UseInputMediaDeviceOptions = {}) => {
|
|
432
447
|
const call = useCall();
|
|
433
448
|
const { screenShare } = call as Call;
|
|
434
449
|
|
|
@@ -438,6 +453,7 @@ export const useScreenShareState = () => {
|
|
|
438
453
|
...getComputedStatus(
|
|
439
454
|
useObservableValue(screenShare.state.status$),
|
|
440
455
|
useObservableValue(screenShare.state.optimisticStatus$),
|
|
456
|
+
{ optimisticUpdates },
|
|
441
457
|
),
|
|
442
458
|
};
|
|
443
459
|
};
|
|
@@ -473,6 +489,7 @@ export const useIsCallCaptioningInProgress = (): boolean => {
|
|
|
473
489
|
function getComputedStatus(
|
|
474
490
|
status: InputDeviceStatus,
|
|
475
491
|
pendingStatus: InputDeviceStatus,
|
|
492
|
+
options: Required<UseInputMediaDeviceOptions>,
|
|
476
493
|
) {
|
|
477
494
|
const optimisticStatus = pendingStatus ?? status;
|
|
478
495
|
|
|
@@ -483,6 +500,14 @@ function getComputedStatus(
|
|
|
483
500
|
isMute: status !== 'enabled',
|
|
484
501
|
optimisticIsMute: optimisticStatus !== 'enabled',
|
|
485
502
|
isTogglePending: optimisticStatus !== status,
|
|
503
|
+
/**
|
|
504
|
+
* If optimistic updates are enabled (`options.optimisticUpdates`), we
|
|
505
|
+
* consider the optimistic status to determine whether the device is muted or not.
|
|
506
|
+
* Otherwise, we rely on the actual status.
|
|
507
|
+
*/
|
|
508
|
+
optionsAwareIsMute: options.optimisticUpdates
|
|
509
|
+
? optimisticStatus !== 'enabled'
|
|
510
|
+
: status !== 'enabled',
|
|
486
511
|
};
|
|
487
512
|
}
|
|
488
513
|
|
package/src/hooks/index.ts
CHANGED