@stream-io/video-react-sdk 0.0.1-alpha.33 → 0.0.1-alpha.34
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 +4 -0
- package/dist/css/styles.css +134 -145
- package/dist/css/styles.css.map +1 -1
- package/dist/src/components/Button/CompositeButton.js +2 -4
- package/dist/src/components/Button/CompositeButton.js.map +1 -1
- package/dist/src/components/StreamCall/CallParticipantsScreenView.js +3 -3
- package/dist/src/components/StreamCall/CallParticipantsScreenView.js.map +1 -1
- package/dist/src/components/StreamCall/CallParticipantsView.js +2 -3
- package/dist/src/components/StreamCall/CallParticipantsView.js.map +1 -1
- package/dist/src/core/components/CallLayout/PaginatedGridLayout.d.ts +3 -7
- package/dist/src/core/components/CallLayout/PaginatedGridLayout.js +7 -11
- package/dist/src/core/components/CallLayout/PaginatedGridLayout.js.map +1 -1
- package/dist/src/core/components/CallLayout/SpeakerLayout.d.ts +6 -1
- package/dist/src/core/components/CallLayout/SpeakerLayout.js +5 -3
- package/dist/src/core/components/CallLayout/SpeakerLayout.js.map +1 -1
- package/dist/src/core/components/ParticipantView/DefaultParticipantViewUI.d.ts +20 -0
- package/dist/src/core/components/ParticipantView/DefaultParticipantViewUI.js +33 -0
- package/dist/src/core/components/ParticipantView/DefaultParticipantViewUI.js.map +1 -0
- package/dist/src/core/components/ParticipantView/ParticipantView.d.ts +82 -0
- package/dist/src/core/components/ParticipantView/ParticipantView.js +28 -0
- package/dist/src/core/components/ParticipantView/ParticipantView.js.map +1 -0
- package/dist/src/core/components/ParticipantView/index.d.ts +2 -0
- package/dist/src/core/components/ParticipantView/index.js +3 -0
- package/dist/src/core/components/ParticipantView/index.js.map +1 -0
- package/dist/src/core/components/Video/BaseVideo.d.ts +3 -3
- package/dist/src/core/components/Video/BaseVideo.js +6 -12
- package/dist/src/core/components/Video/BaseVideo.js.map +1 -1
- package/dist/src/core/components/Video/Video.d.ts +8 -6
- package/dist/src/core/components/Video/Video.js +27 -25
- package/dist/src/core/components/Video/Video.js.map +1 -1
- package/dist/src/core/components/Video/VideoPlaceholder.d.ts +3 -3
- package/dist/src/core/components/Video/VideoPlaceholder.js +2 -5
- package/dist/src/core/components/Video/VideoPlaceholder.js.map +1 -1
- package/dist/src/core/components/index.d.ts +2 -2
- package/dist/src/core/components/index.js +1 -1
- package/dist/src/core/components/index.js.map +1 -1
- package/dist/src/core/hooks/index.d.ts +1 -0
- package/dist/src/core/hooks/index.js +1 -0
- package/dist/src/core/hooks/index.js.map +1 -1
- package/dist/src/core/hooks/useTrackElementVisibility.d.ts +6 -0
- package/dist/src/core/hooks/useTrackElementVisibility.js +24 -0
- package/dist/src/core/hooks/useTrackElementVisibility.js.map +1 -0
- package/dist/src/utilities/applyElementRef.d.ts +2 -0
- package/dist/src/utilities/applyElementRef.js +8 -0
- package/dist/src/utilities/applyElementRef.js.map +1 -0
- package/dist/src/utilities/chunk.d.ts +1 -0
- package/dist/src/utilities/chunk.js +5 -0
- package/dist/src/utilities/chunk.js.map +1 -0
- package/dist/src/utilities/index.d.ts +3 -0
- package/dist/src/utilities/index.js +4 -0
- package/dist/src/utilities/index.js.map +1 -0
- package/dist/src/utilities/isComponentType.d.ts +2 -0
- package/dist/src/utilities/isComponentType.js +7 -0
- package/dist/src/utilities/isComponentType.js.map +1 -0
- package/package.json +5 -5
- package/src/components/Button/CompositeButton.tsx +4 -13
- package/src/components/StreamCall/CallParticipantsScreenView.tsx +3 -4
- package/src/components/StreamCall/CallParticipantsView.tsx +3 -4
- package/src/core/components/CallLayout/PaginatedGridLayout.tsx +21 -40
- package/src/core/components/CallLayout/SpeakerLayout.tsx +46 -19
- package/src/core/components/ParticipantView/DefaultParticipantViewUI.tsx +165 -0
- package/src/core/components/ParticipantView/ParticipantView.tsx +136 -0
- package/src/core/components/ParticipantView/index.ts +2 -0
- package/src/core/components/Video/BaseVideo.tsx +9 -24
- package/src/core/components/Video/Video.tsx +55 -44
- package/src/core/components/Video/VideoPlaceholder.tsx +7 -11
- package/src/core/components/index.ts +2 -2
- package/src/core/hooks/index.ts +1 -0
- package/src/core/hooks/useTrackElementVisibility.ts +41 -0
- package/src/utilities/applyElementRef.ts +12 -0
- package/src/utilities/chunk.ts +8 -0
- package/src/utilities/index.ts +3 -0
- package/src/utilities/isComponentType.ts +9 -0
- package/dist/src/core/components/ParticipantBox/ParticipantBox.d.ts +0 -48
- package/dist/src/core/components/ParticipantBox/ParticipantBox.js +0 -58
- package/dist/src/core/components/ParticipantBox/ParticipantBox.js.map +0 -1
- package/dist/src/core/components/ParticipantBox/index.d.ts +0 -1
- package/dist/src/core/components/ParticipantBox/index.js +0 -2
- package/dist/src/core/components/ParticipantBox/index.js.map +0 -1
- package/src/core/components/ParticipantBox/ParticipantBox.tsx +0 -248
- package/src/core/components/ParticipantBox/index.ts +0 -1
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { DefaultParticipantViewUI, ParticipantView } from '../../core';
|
|
3
3
|
import { useLocalParticipant, useParticipants, } from '@stream-io/video-react-bindings';
|
|
4
4
|
export const CallParticipantsView = (props) => {
|
|
5
|
-
const { call } = props;
|
|
6
5
|
const localParticipant = useLocalParticipant();
|
|
7
6
|
const participants = useParticipants();
|
|
8
7
|
const grid = `str-video__grid-${participants.length || 1}`;
|
|
9
|
-
return (_jsx("div", Object.assign({ className: `str-video__call-participants-view ${grid}` }, { children: participants.map((participant) => (_jsx(
|
|
8
|
+
return (_jsx("div", Object.assign({ className: `str-video__call-participants-view ${grid}` }, { children: participants.map((participant) => (_jsx(ParticipantView, { participant: participant, sinkId: localParticipant === null || localParticipant === void 0 ? void 0 : localParticipant.audioOutputDeviceId, ParticipantViewUI: DefaultParticipantViewUI }, participant.sessionId))) })));
|
|
10
9
|
};
|
|
11
10
|
//# sourceMappingURL=CallParticipantsView.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CallParticipantsView.js","sourceRoot":"","sources":["../../../../src/components/StreamCall/CallParticipantsView.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"CallParticipantsView.js","sourceRoot":"","sources":["../../../../src/components/StreamCall/CallParticipantsView.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,wBAAwB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AACvE,OAAO,EACL,mBAAmB,EACnB,eAAe,GAChB,MAAM,iCAAiC,CAAC;AAEzC,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,KAAqB,EAAE,EAAE;IAC5D,MAAM,gBAAgB,GAAG,mBAAmB,EAAE,CAAC;IAC/C,MAAM,YAAY,GAAG,eAAe,EAAE,CAAC;IACvC,MAAM,IAAI,GAAG,mBAAmB,YAAY,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;IAC3D,OAAO,CACL,4BAAK,SAAS,EAAE,qCAAqC,IAAI,EAAE,gBACxD,YAAY,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CACjC,KAAC,eAAe,IAEd,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,mBAAmB,EAC7C,iBAAiB,EAAE,wBAAwB,IAHtC,WAAW,CAAC,SAAS,CAI1B,CACH,CAAC,IACE,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { ParticipantViewProps } from '../ParticipantView';
|
|
2
3
|
export type PaginatedGridLayoutProps = {
|
|
3
4
|
/**
|
|
4
5
|
* The number of participants to display per page.
|
|
@@ -8,14 +9,9 @@ export type PaginatedGridLayoutProps = {
|
|
|
8
9
|
* Whether to exclude the local participant from the grid.
|
|
9
10
|
*/
|
|
10
11
|
excludeLocalParticipant?: boolean;
|
|
11
|
-
/**
|
|
12
|
-
* Turns on/off the status indicator icons (mute, connection quality, etc...)
|
|
13
|
-
* on the participant boxes.
|
|
14
|
-
*/
|
|
15
|
-
indicatorsVisible?: boolean;
|
|
16
12
|
/**
|
|
17
13
|
* Turns on/off the pagination arrows.
|
|
18
14
|
*/
|
|
19
15
|
pageArrowsVisible?: boolean;
|
|
20
|
-
}
|
|
21
|
-
export declare const PaginatedGridLayout: ({ groupSize, excludeLocalParticipant,
|
|
16
|
+
} & Pick<ParticipantViewProps, 'ParticipantViewUI' | 'VideoPlaceholder'>;
|
|
17
|
+
export declare const PaginatedGridLayout: ({ groupSize, excludeLocalParticipant, pageArrowsVisible, VideoPlaceholder, ParticipantViewUI, }: PaginatedGridLayoutProps) => JSX.Element | null;
|
|
@@ -2,18 +2,19 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
2
2
|
import { useEffect, useMemo, useState } from 'react';
|
|
3
3
|
import { useCall, useLocalParticipant, useParticipants, useRemoteParticipants, } from '@stream-io/video-react-bindings';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
|
-
import {
|
|
5
|
+
import { ParticipantView, DefaultParticipantViewUI, } from '../ParticipantView';
|
|
6
6
|
import { Audio } from '../Audio';
|
|
7
7
|
import { IconButton } from '../../../components';
|
|
8
|
+
import { chunk } from '../../../utilities';
|
|
8
9
|
const GROUP_SIZE = 16;
|
|
9
|
-
const PaginatedGridLayoutGroup = ({
|
|
10
|
-
return (_jsx("div", Object.assign({ className: clsx('str-video__paginated-grid-
|
|
10
|
+
const PaginatedGridLayoutGroup = ({ group, VideoPlaceholder, ParticipantViewUI, }) => {
|
|
11
|
+
return (_jsx("div", Object.assign({ className: clsx('str-video__paginated-grid-layout__group', {
|
|
11
12
|
'str-video__paginated-grid-layout--one': group.length === 1,
|
|
12
13
|
'str-video__paginated-grid-layout--two-four': group.length >= 2 && group.length <= 4,
|
|
13
14
|
'str-video__paginated-grid-layout--five-nine': group.length >= 5 && group.length <= 9,
|
|
14
|
-
}) }, { children: group.map((participant) => (_jsx(
|
|
15
|
+
}) }, { children: group.map((participant) => (_jsx(ParticipantView, { participant: participant, muteAudio: true, VideoPlaceholder: VideoPlaceholder, ParticipantViewUI: ParticipantViewUI }, participant.sessionId))) })));
|
|
15
16
|
};
|
|
16
|
-
export const PaginatedGridLayout = ({ groupSize = GROUP_SIZE, excludeLocalParticipant = false,
|
|
17
|
+
export const PaginatedGridLayout = ({ groupSize = GROUP_SIZE, excludeLocalParticipant = false, pageArrowsVisible = true, VideoPlaceholder, ParticipantViewUI = DefaultParticipantViewUI, }) => {
|
|
17
18
|
const [page, setPage] = useState(0);
|
|
18
19
|
const call = useCall();
|
|
19
20
|
const localParticipant = useLocalParticipant();
|
|
@@ -32,11 +33,6 @@ export const PaginatedGridLayout = ({ groupSize = GROUP_SIZE, excludeLocalPartic
|
|
|
32
33
|
const selectedGroup = participantGroups[page];
|
|
33
34
|
if (!call)
|
|
34
35
|
return null;
|
|
35
|
-
return (_jsxs(_Fragment, { children: [remoteParticipants.map((participant) => (_jsx(Audio, { muted: false, audioStream: participant.audioStream, sinkId: localParticipant === null || localParticipant === void 0 ? void 0 : localParticipant.audioOutputDeviceId }, participant.sessionId))), _jsx("div", Object.assign({ className: "str-video__paginated-grid-
|
|
36
|
-
};
|
|
37
|
-
// TODO: move to utilities
|
|
38
|
-
const chunk = (array, size = GROUP_SIZE) => {
|
|
39
|
-
const chunkCount = Math.ceil(array.length / size);
|
|
40
|
-
return Array.from({ length: chunkCount }, (_, index) => array.slice(size * index, size * index + size));
|
|
36
|
+
return (_jsxs(_Fragment, { children: [remoteParticipants.map((participant) => (_jsx(Audio, { muted: false, audioStream: participant.audioStream, sinkId: localParticipant === null || localParticipant === void 0 ? void 0 : localParticipant.audioOutputDeviceId }, participant.sessionId))), _jsx("div", Object.assign({ className: "str-video__paginated-grid-layout__wrapper" }, { children: _jsxs("div", Object.assign({ className: "str-video__paginated-grid-layout" }, { children: [pageArrowsVisible && pageCount > 1 && (_jsx(IconButton, { icon: "caret-left", disabled: page === 0, onClick: () => setPage((currentPage) => Math.max(0, currentPage - 1)) })), selectedGroup && (_jsx(PaginatedGridLayoutGroup, { group: participantGroups[page], VideoPlaceholder: VideoPlaceholder, ParticipantViewUI: ParticipantViewUI })), pageArrowsVisible && pageCount > 1 && (_jsx(IconButton, { disabled: page === pageCount - 1, icon: "caret-right", onClick: () => setPage((currentPage) => Math.min(pageCount - 1, currentPage + 1)) }))] })) }))] }));
|
|
41
37
|
};
|
|
42
38
|
//# sourceMappingURL=PaginatedGridLayout.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PaginatedGridLayout.js","sourceRoot":"","sources":["../../../../../src/core/components/CallLayout/PaginatedGridLayout.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,EACL,OAAO,EACP,mBAAmB,EACnB,eAAe,EACf,qBAAqB,GACtB,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"PaginatedGridLayout.js","sourceRoot":"","sources":["../../../../../src/core/components/CallLayout/PaginatedGridLayout.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,EACL,OAAO,EACP,mBAAmB,EACnB,eAAe,EACf,qBAAqB,GACtB,MAAM,iCAAiC,CAAC;AAKzC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EACL,eAAe,EACf,wBAAwB,GAEzB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,MAAM,UAAU,GAAG,EAAE,CAAC;AAUtB,MAAM,wBAAwB,GAAG,CAAC,EAChC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BAAiB,GACpC,CACH,EACA,iBAAiB,IAAI,SAAS,GAAG,CAAC,IAAI,CACrC,KAAC,UAAU,IACT,QAAQ,EAAE,IAAI,KAAK,SAAS,GAAG,CAAC,EAChC,IAAI,EAAC,aAAa,EAClB,OAAO,EAAE,GAAG,EAAE,CACZ,OAAO,CAAC,CAAC,WAAW,EAAE,EAAE,CACtB,IAAI,CAAC,GAAG,CAAC,SAAS,GAAG,CAAC,EAAE,WAAW,GAAG,CAAC,CAAC,CACzC,GAEH,CACH,KACG,IACF,IACL,CACJ,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
2
|
+
import { ParticipantViewProps } from '../ParticipantView';
|
|
3
|
+
export type SpeakerLayoutProps = {
|
|
4
|
+
ParticipantViewUISpotlight?: ParticipantViewProps['ParticipantViewUI'];
|
|
5
|
+
ParticipantViewUIBar?: ParticipantViewProps['ParticipantViewUI'];
|
|
6
|
+
} & Pick<ParticipantViewProps, 'VideoPlaceholder'>;
|
|
7
|
+
export declare const SpeakerLayout: ({ ParticipantViewUIBar, ParticipantViewUISpotlight, VideoPlaceholder, }: SpeakerLayoutProps) => JSX.Element | null;
|
|
@@ -2,10 +2,12 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useEffect, useState } from 'react';
|
|
3
3
|
import { CallTypes, combineComparators, defaultSortPreset, screenSharing, SfuModels, speakerLayoutSortPreset, } from '@stream-io/video-client';
|
|
4
4
|
import { useCall, useLocalParticipant, useParticipants, } from '@stream-io/video-react-bindings';
|
|
5
|
-
import {
|
|
5
|
+
import { ParticipantView, DefaultParticipantViewUI, } from '../ParticipantView';
|
|
6
6
|
import { IconButton } from '../../../components';
|
|
7
7
|
import { useHorizontalScrollPosition } from '../../../components/StreamCall/hooks';
|
|
8
|
-
|
|
8
|
+
const DefaultParticipantViewUIBar = ({ participant, }) => (_jsx(DefaultParticipantViewUI, { participant: participant, menuPlacement: "top-end" }));
|
|
9
|
+
const DefaultParticipantViewUISpotlight = ({ participant, }) => (_jsx(DefaultParticipantViewUI, { participant: participant }));
|
|
10
|
+
export const SpeakerLayout = ({ ParticipantViewUIBar = DefaultParticipantViewUIBar, ParticipantViewUISpotlight = DefaultParticipantViewUISpotlight, VideoPlaceholder, }) => {
|
|
9
11
|
const call = useCall();
|
|
10
12
|
const [participantInSpotlight, ...otherParticipants] = useParticipants();
|
|
11
13
|
const [scrollWrapper, setScrollWrapper] = useState(null);
|
|
@@ -43,7 +45,7 @@ export const SpeakerLayout = () => {
|
|
|
43
45
|
if (!call)
|
|
44
46
|
return null;
|
|
45
47
|
const isSpeakerScreenSharing = hasScreenShare(participantInSpotlight);
|
|
46
|
-
return (_jsx("div", Object.assign({ className: "str-video__speaker-
|
|
48
|
+
return (_jsx("div", Object.assign({ className: "str-video__speaker-layout__wrapper" }, { children: _jsxs("div", Object.assign({ className: "str-video__speaker-layout" }, { children: [_jsx("div", Object.assign({ className: "str-video__speaker-layout__spotlight" }, { children: participantInSpotlight && (_jsx(ParticipantView, { participant: participantInSpotlight, muteAudio: isSpeakerScreenSharing, videoKind: isSpeakerScreenSharing ? 'screen' : 'video', sinkId: localParticipant === null || localParticipant === void 0 ? void 0 : localParticipant.audioOutputDeviceId, ParticipantViewUI: ParticipantViewUISpotlight, VideoPlaceholder: VideoPlaceholder })) })), otherParticipants.length > 0 && (_jsxs("div", Object.assign({ className: "str-video__speaker-layout__participants-bar-buttons-wrapper" }, { children: [scrollPosition && scrollPosition !== 'start' && (_jsx(IconButton, { onClick: scrollStartClickHandler, icon: "caret-left", className: "str-video__speaker-layout__participants-bar--button-left" })), _jsx("div", Object.assign({ className: "str-video__speaker-layout__participants-bar-wrapper", ref: setScrollWrapper }, { children: _jsxs("div", Object.assign({ className: "str-video__speaker-layout__participants-bar" }, { children: [isSpeakerScreenSharing && (_jsx("div", Object.assign({ className: "str-video__speaker-layout__participant-tile" }, { children: _jsx(ParticipantView, { participant: participantInSpotlight, sinkId: localParticipant === null || localParticipant === void 0 ? void 0 : localParticipant.audioOutputDeviceId, ParticipantViewUI: ParticipantViewUIBar, VideoPlaceholder: VideoPlaceholder }) }), participantInSpotlight.sessionId)), otherParticipants.map((participant) => (_jsx("div", Object.assign({ className: "str-video__speaker-layout__participant-tile" }, { children: _jsx(ParticipantView, { participant: participant, sinkId: localParticipant === null || localParticipant === void 0 ? void 0 : localParticipant.audioOutputDeviceId, ParticipantViewUI: ParticipantViewUIBar, VideoPlaceholder: VideoPlaceholder }) }), participant.sessionId)))] })) })), scrollPosition && scrollPosition !== 'end' && (_jsx(IconButton, { onClick: scrollEndClickHandler, icon: "caret-right", className: "str-video__speaker-layout__participants-bar--button-right" }))] })))] })) })));
|
|
47
49
|
};
|
|
48
50
|
const hasScreenShare = (p) => p.publishedTracks.includes(SfuModels.TrackType.SCREEN_SHARE);
|
|
49
51
|
const loggedIn = (a, b) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpeakerLayout.js","sourceRoot":"","sources":["../../../../../src/core/components/CallLayout/SpeakerLayout.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EACL,SAAS,EACT,kBAAkB,EAElB,iBAAiB,EACjB,aAAa,EACb,SAAS,EACT,uBAAuB,GAExB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,OAAO,EACP,mBAAmB,EACnB,eAAe,GAChB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,
|
|
1
|
+
{"version":3,"file":"SpeakerLayout.js","sourceRoot":"","sources":["../../../../../src/core/components/CallLayout/SpeakerLayout.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EACL,SAAS,EACT,kBAAkB,EAElB,iBAAiB,EACjB,aAAa,EACb,SAAS,EACT,uB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B,CACP,CAAC,KACE,IACF,EACL,cAAc,IAAI,cAAc,KAAK,KAAK,IAAI,CAC7C,KAAC,UAAU,IACT,OAAO,EAAE,qBAAqB,EAC9B,IAAI,EAAC,aAAa,EAClB,SAAS,EAAC,2DAA2D,GACrE,CACH,KACG,CACP,KACG,IACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,cAAc,GAAG,CAAC,CAAyB,EAAE,EAAE,CACnD,CAAC,CAAC,eAAe,CAAC,QAAQ,CAAC,SAAS,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;AAE/D,MAAM,QAAQ,GAAuC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;IAC5D,IAAI,CAAC,CAAC,cAAc;QAAE,OAAO,CAAC,CAAC;IAC/B,IAAI,CAAC,CAAC,cAAc;QAAE,OAAO,CAAC,CAAC,CAAC;IAChC,OAAO,CAAC,CAAC;AACX,CAAC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Placement } from '@floating-ui/react';
|
|
3
|
+
import { ParticipantViewProps } from './ParticipantView';
|
|
4
|
+
export type ParticipantViewUIProps = Pick<ParticipantViewProps, 'participant'>;
|
|
5
|
+
export type DefaultParticipantViewUIProps = {
|
|
6
|
+
/**
|
|
7
|
+
* Turns on/off the status indicator icons (mute, connection quality, etc...).
|
|
8
|
+
*/
|
|
9
|
+
indicatorsVisible?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Placement of the context menu component when opened
|
|
12
|
+
*/
|
|
13
|
+
menuPlacement?: Placement;
|
|
14
|
+
/**
|
|
15
|
+
* Option to show/hide menu button component
|
|
16
|
+
*/
|
|
17
|
+
showMenuButton?: boolean;
|
|
18
|
+
} & ParticipantViewUIProps;
|
|
19
|
+
export declare const DefaultParticipantViewUI: ({ participant, indicatorsVisible, menuPlacement, showMenuButton, }: DefaultParticipantViewUIProps) => JSX.Element;
|
|
20
|
+
export declare const ParticipantDetails: ({ participant, indicatorsVisible, }: Pick<DefaultParticipantViewUIProps, 'participant' | 'indicatorsVisible'>) => JSX.Element;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { SfuModels } from '@stream-io/video-client';
|
|
4
|
+
import { useCall } from '@stream-io/video-react-bindings';
|
|
5
|
+
import { clsx } from 'clsx';
|
|
6
|
+
import { IconButton, MenuToggle, Notification, ParticipantActionsContextMenu, } from '../../../components';
|
|
7
|
+
import { Reaction } from '../../../components/Reaction';
|
|
8
|
+
import { DebugParticipantPublishQuality } from '../../../components/Debug/DebugParticipantPublishQuality';
|
|
9
|
+
import { DebugStatsView } from '../../../components/Debug/DebugStatsView';
|
|
10
|
+
import { useIsDebugMode } from '../../../components/Debug/useIsDebugMode';
|
|
11
|
+
const ToggleButton = forwardRef((props, ref) => {
|
|
12
|
+
return _jsx(IconButton, { enabled: props.menuShown, icon: "ellipsis", ref: ref });
|
|
13
|
+
});
|
|
14
|
+
export const DefaultParticipantViewUI = ({ participant, indicatorsVisible = true, menuPlacement = 'bottom-end', showMenuButton = true, }) => {
|
|
15
|
+
const call = useCall();
|
|
16
|
+
const { reaction, sessionId } = participant;
|
|
17
|
+
return (_jsxs(_Fragment, { children: [showMenuButton && (_jsx(MenuToggle, Object.assign({ strategy: "fixed", placement: menuPlacement, ToggleButton: ToggleButton }, { children: _jsx(ParticipantActionsContextMenu, { participant: participant }) }))), reaction && (_jsx(Reaction, { reaction: reaction, sessionId: sessionId, call: call })), _jsx(ParticipantDetails, { participant: participant, indicatorsVisible: indicatorsVisible })] }));
|
|
18
|
+
};
|
|
19
|
+
export const ParticipantDetails = ({ participant, indicatorsVisible = true, }) => {
|
|
20
|
+
const { isDominantSpeaker, isLoggedInUser, connectionQuality, publishedTracks, pinnedAt, sessionId, name, userId, videoStream, } = participant;
|
|
21
|
+
const call = useCall();
|
|
22
|
+
const connectionQualityAsString = !!connectionQuality &&
|
|
23
|
+
String(SfuModels.ConnectionQuality[connectionQuality]).toLowerCase();
|
|
24
|
+
const hasAudio = publishedTracks.includes(SfuModels.TrackType.AUDIO);
|
|
25
|
+
const hasVideo = publishedTracks.includes(SfuModels.TrackType.VIDEO);
|
|
26
|
+
const isPinned = !!pinnedAt;
|
|
27
|
+
const isDebugMode = useIsDebugMode();
|
|
28
|
+
return (_jsxs("div", Object.assign({ className: "str-video__participant-details" }, { children: [_jsxs("span", Object.assign({ className: "str-video__participant-details__name" }, { children: [name || userId, indicatorsVisible && isDominantSpeaker && (_jsx("span", { className: "str-video__participant-details__name--dominant_speaker", title: "Dominant speaker" })), indicatorsVisible && (_jsx(Notification, Object.assign({ isVisible: isLoggedInUser &&
|
|
29
|
+
connectionQuality === SfuModels.ConnectionQuality.POOR, message: "Poor connection quality. Please check your internet connection." }, { children: connectionQualityAsString && (_jsx("span", { className: clsx('str-video__participant-details__connection-quality', `str-video__participant-details__connection-quality--${connectionQualityAsString}`), title: connectionQualityAsString })) }))), indicatorsVisible && !hasAudio && (_jsx("span", { className: "str-video__participant-details__name--audio-muted" })), indicatorsVisible && !hasVideo && (_jsx("span", { className: "str-video__participant-details__name--video-muted" })), indicatorsVisible && isPinned && (
|
|
30
|
+
// TODO: remove this monstrosity once we have a proper design
|
|
31
|
+
_jsx("span", { title: "Unpin", onClick: () => call === null || call === void 0 ? void 0 : call.setParticipantPinnedAt(sessionId), style: { cursor: 'pointer' }, className: "str-video__participant-details__name--pinned" }))] })), isDebugMode && (_jsxs(_Fragment, { children: [_jsx(DebugParticipantPublishQuality, { participant: participant, call: call }), _jsx(DebugStatsView, { call: call, kind: isLoggedInUser ? 'publisher' : 'subscriber', mediaStream: videoStream })] }))] })));
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=DefaultParticipantViewUI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DefaultParticipantViewUI.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AAS,CAAC,iBAAiB,CAAC,IAAI,EAExD,OAAO,EAAC,iEAAiE,gBAExE,yBAAyB,IAAI,CAC5B,eACE,SAAS,EAAE,IAAI,CACb,oDAAoD,EACpD,uDAAuD,yBAAyB,EAAE,CACnF,EACD,KAAK,EAAE,yBAAyB,GAChC,CACH,IACY,CAChB,EACA,iBAAiB,IAAI,CAAC,QAAQ,IAAI,CACjC,eAAM,SAAS,EAAC,mDAAmD,GAAG,CACvE,EACA,iBAAiB,IAAI,CAAC,QAAQ,IAAI,CACjC,eAAM,SAAS,EAAC,mDAAmD,GAAG,CACvE,EACA,iBAAiB,IAAI,QAAQ,IAAI;oBAChC,6DAA6D;oBAC7D,eACE,KAAK,EAAC,OAAO,EACb,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,sBAAsB,CAAC,SAAS,CAAC,EACtD,KAAK,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,EAC5B,SAAS,EAAC,8CAA8C,GACxD,CACH,KACI,EACN,WAAW,IAAI,CACd,8BACE,KAAC,8BAA8B,IAC7B,WAAW,EAAE,WAAW,EACxB,IAAI,EAAE,IAAI,GACV,EACF,KAAC,cAAc,IACb,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,cAAc,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,YAAY,EACjD,WAAW,EAAE,WAAW,GACxB,IACD,CACJ,KACG,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { ComponentType, ReactElement } from 'react';
|
|
2
|
+
import { StreamVideoLocalParticipant, StreamVideoParticipant } from '@stream-io/video-client';
|
|
3
|
+
import { VideoProps } from '../Video';
|
|
4
|
+
import { ParticipantViewUIProps } from './DefaultParticipantViewUI';
|
|
5
|
+
export type ParticipantViewProps = {
|
|
6
|
+
/**
|
|
7
|
+
* The participant bound to this component.
|
|
8
|
+
*/
|
|
9
|
+
participant: StreamVideoParticipant | StreamVideoLocalParticipant;
|
|
10
|
+
/**
|
|
11
|
+
* Component used to render user interface elements (details, network status...),
|
|
12
|
+
* pass `null` if you wish to not render anything
|
|
13
|
+
* @default DefaultParticipantViewUI
|
|
14
|
+
*/
|
|
15
|
+
ParticipantViewUI?: ComponentType<ParticipantViewUIProps> | ReactElement | null;
|
|
16
|
+
/**
|
|
17
|
+
* In supported browsers, this sets the default audio output.
|
|
18
|
+
* The value of this prop should be a valid Audio Output `deviceId`.
|
|
19
|
+
*/
|
|
20
|
+
sinkId?: string;
|
|
21
|
+
/**
|
|
22
|
+
* The kind of video stream to play for the given participant.
|
|
23
|
+
*/
|
|
24
|
+
videoKind?: 'video' | 'screen';
|
|
25
|
+
/**
|
|
26
|
+
* Turns on/off the audio for the participant.
|
|
27
|
+
*/
|
|
28
|
+
muteAudio?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* A function meant for exposing the "native" element ref to the integrators.
|
|
31
|
+
* The element can either be:
|
|
32
|
+
* - `<video />` for participants with enabled video.
|
|
33
|
+
* - `<div />` for participants with disabled video. This ref would point to
|
|
34
|
+
* the VideoPlaceholder component.
|
|
35
|
+
*
|
|
36
|
+
* @param element the element ref.
|
|
37
|
+
*/
|
|
38
|
+
setVideoElementRef?: (element: HTMLElement | null) => void;
|
|
39
|
+
/**
|
|
40
|
+
* Custom class applied to the root DOM element.
|
|
41
|
+
*/
|
|
42
|
+
className?: string;
|
|
43
|
+
} & Pick<VideoProps, 'VideoPlaceholder'>;
|
|
44
|
+
export declare const ParticipantView: import("react").ForwardRefExoticComponent<{
|
|
45
|
+
/**
|
|
46
|
+
* The participant bound to this component.
|
|
47
|
+
*/
|
|
48
|
+
participant: StreamVideoParticipant | StreamVideoLocalParticipant;
|
|
49
|
+
/**
|
|
50
|
+
* Component used to render user interface elements (details, network status...),
|
|
51
|
+
* pass `null` if you wish to not render anything
|
|
52
|
+
* @default DefaultParticipantViewUI
|
|
53
|
+
*/
|
|
54
|
+
ParticipantViewUI?: ReactElement<any, string | import("react").JSXElementConstructor<any>> | ComponentType<ParticipantViewUIProps> | null | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* In supported browsers, this sets the default audio output.
|
|
57
|
+
* The value of this prop should be a valid Audio Output `deviceId`.
|
|
58
|
+
*/
|
|
59
|
+
sinkId?: string | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* The kind of video stream to play for the given participant.
|
|
62
|
+
*/
|
|
63
|
+
videoKind?: "video" | "screen" | undefined;
|
|
64
|
+
/**
|
|
65
|
+
* Turns on/off the audio for the participant.
|
|
66
|
+
*/
|
|
67
|
+
muteAudio?: boolean | undefined;
|
|
68
|
+
/**
|
|
69
|
+
* A function meant for exposing the "native" element ref to the integrators.
|
|
70
|
+
* The element can either be:
|
|
71
|
+
* - `<video />` for participants with enabled video.
|
|
72
|
+
* - `<div />` for participants with disabled video. This ref would point to
|
|
73
|
+
* the VideoPlaceholder component.
|
|
74
|
+
*
|
|
75
|
+
* @param element the element ref.
|
|
76
|
+
*/
|
|
77
|
+
setVideoElementRef?: ((element: HTMLElement | null) => void) | undefined;
|
|
78
|
+
/**
|
|
79
|
+
* Custom class applied to the root DOM element.
|
|
80
|
+
*/
|
|
81
|
+
className?: string | undefined;
|
|
82
|
+
} & Pick<VideoProps, "VideoPlaceholder"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useState } from 'react';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import { SfuModels, } from '@stream-io/video-client';
|
|
5
|
+
import { Audio } from '../Audio';
|
|
6
|
+
import { Video } from '../Video';
|
|
7
|
+
import { useTrackElementVisibility } from '../../hooks';
|
|
8
|
+
import { DefaultParticipantViewUI, } from './DefaultParticipantViewUI';
|
|
9
|
+
import { isComponentType, applyElementRef } from '../../../utilities';
|
|
10
|
+
export const ParticipantView = forwardRef(({ participant, sinkId, videoKind = 'video', muteAudio, setVideoElementRef, className, VideoPlaceholder, ParticipantViewUI = DefaultParticipantViewUI, }, ref) => {
|
|
11
|
+
const { audioStream, isLoggedInUser, isSpeaking, publishedTracks, sessionId, } = participant;
|
|
12
|
+
const hasAudio = publishedTracks.includes(SfuModels.TrackType.AUDIO);
|
|
13
|
+
const hasVideo = publishedTracks.includes(SfuModels.TrackType.VIDEO);
|
|
14
|
+
const [trackedElement, setTrackedElement] = useState(null);
|
|
15
|
+
useTrackElementVisibility({
|
|
16
|
+
sessionId,
|
|
17
|
+
trackedElement,
|
|
18
|
+
});
|
|
19
|
+
return (_jsxs("div", Object.assign({ ref: (element) => {
|
|
20
|
+
applyElementRef(ref, element);
|
|
21
|
+
setTrackedElement(element);
|
|
22
|
+
}, className: clsx('str-video__participant-view', isSpeaking && 'str-video__participant-view--speaking', !hasVideo && 'str-video__participant-view--no-video', !hasAudio && 'str-video__participant-view--no-audio', className) }, { children: [_jsx(Audio
|
|
23
|
+
// mute the local participant, as we don't want to hear ourselves
|
|
24
|
+
, {
|
|
25
|
+
// mute the local participant, as we don't want to hear ourselves
|
|
26
|
+
muted: isLoggedInUser || muteAudio, sinkId: sinkId, audioStream: audioStream }), _jsx(Video, { VideoPlaceholder: VideoPlaceholder, participant: participant, kind: videoKind, setVideoElementRef: setVideoElementRef, autoPlay: true }), isComponentType(ParticipantViewUI) ? (_jsx(ParticipantViewUI, { participant: participant })) : (ParticipantViewUI)] })));
|
|
27
|
+
});
|
|
28
|
+
//# sourceMappingURL=ParticipantView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ParticipantView.js","sourceRoot":"","sources":["../../../../../src/core/components/ParticipantView/ParticipantView.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAiB,QAAQ,EAAgB,MAAM,OAAO,CAAC;AAC1E,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EACL,SAAS,GAGV,MAAM,yB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EAAiE;;gBAAjE,iEAAiE;gBACjE,KAAK,EAAE,cAAc,IAAI,SAAS,EAClC,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,WAAW,GACxB,EACF,KAAC,KAAK,IACJ,gBAAgB,EAAE,gBAAgB,EAClC,WAAW,EAAE,WAAW,EACxB,IAAI,EAAE,SAAS,EACf,kBAAkB,EAAE,kBAAkB,EACtC,QAAQ,SACR,EACD,eAAe,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CACpC,KAAC,iBAAiB,IAAC,WAAW,EAAE,WAAW,GAAI,CAChD,CAAC,CAAC,CAAC,CACF,iBAAiB,CAClB,KACG,CACP,CAAC;AACJ,CAAC,CACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/core/components/ParticipantView/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,4BAA4B,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export type
|
|
1
|
+
import { ComponentPropsWithRef } from 'react';
|
|
2
|
+
export type BaseVideoProps = ComponentPropsWithRef<'video'> & {
|
|
3
3
|
stream?: MediaStream;
|
|
4
4
|
};
|
|
5
5
|
/**
|
|
6
6
|
* @description Extends video element with `stream` property
|
|
7
7
|
* (`srcObject`) to reactively handle stream changes
|
|
8
8
|
*/
|
|
9
|
-
export declare const BaseVideo: import("react").ForwardRefExoticComponent<Omit<
|
|
9
|
+
export declare const BaseVideo: import("react").ForwardRefExoticComponent<Omit<BaseVideoProps, "ref"> & import("react").RefAttributes<HTMLVideoElement>>;
|
|
@@ -10,9 +10,9 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
import { forwardRef, useEffect, useState
|
|
14
|
-
import clsx from 'clsx';
|
|
13
|
+
import { forwardRef, useEffect, useState } from 'react';
|
|
15
14
|
import { Browsers } from '@stream-io/video-client';
|
|
15
|
+
import { applyElementRef } from '../../../utilities';
|
|
16
16
|
/**
|
|
17
17
|
* @description Extends video element with `stream` property
|
|
18
18
|
* (`srcObject`) to reactively handle stream changes
|
|
@@ -20,15 +20,6 @@ import { Browsers } from '@stream-io/video-client';
|
|
|
20
20
|
export const BaseVideo = forwardRef((_a, ref) => {
|
|
21
21
|
var { stream } = _a, rest = __rest(_a, ["stream"]);
|
|
22
22
|
const [videoElement, setVideoElement] = useState(null);
|
|
23
|
-
const setRef = (instance) => {
|
|
24
|
-
setVideoElement(instance);
|
|
25
|
-
if (typeof ref === 'function') {
|
|
26
|
-
ref(instance);
|
|
27
|
-
}
|
|
28
|
-
else if (ref) {
|
|
29
|
-
ref.current = instance;
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
23
|
useEffect(() => {
|
|
33
24
|
if (!videoElement || !stream)
|
|
34
25
|
return;
|
|
@@ -49,6 +40,9 @@ export const BaseVideo = forwardRef((_a, ref) => {
|
|
|
49
40
|
videoElement.srcObject = null;
|
|
50
41
|
};
|
|
51
42
|
}, [stream, videoElement]);
|
|
52
|
-
return (_jsx("video", Object.assign({ autoPlay: true, playsInline: true }, rest, {
|
|
43
|
+
return (_jsx("video", Object.assign({ autoPlay: true, playsInline: true }, rest, { ref: (element) => {
|
|
44
|
+
applyElementRef(ref, element);
|
|
45
|
+
setVideoElement(element);
|
|
46
|
+
} })));
|
|
53
47
|
});
|
|
54
48
|
//# sourceMappingURL=BaseVideo.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseVideo.js","sourceRoot":"","sources":["../../../../../src/core/components/Video/BaseVideo.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"BaseVideo.js","sourceRoot":"","sources":["../../../../../src/core/components/Video/BaseVideo.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,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YACf,eAAe,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;YAC9B,eAAe,CAAC,OAAO,CAAC,CAAC;QAC3B,CAAC,IACD,CACH,CAAC;AACJ,CAAC,CACF,CAAC"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { ComponentType, ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
import { StreamVideoParticipant } from '@stream-io/video-client';
|
|
3
|
+
import { VideoPlaceholderProps } from './VideoPlaceholder';
|
|
4
|
+
export type VideoProps = ComponentPropsWithoutRef<'video'> & {
|
|
5
5
|
kind: 'video' | 'screen';
|
|
6
6
|
participant: StreamVideoParticipant;
|
|
7
|
-
setVideoElementRef?: (
|
|
8
|
-
|
|
7
|
+
setVideoElementRef?: (element: HTMLElement | null) => void;
|
|
8
|
+
VideoPlaceholder?: ComponentType<VideoPlaceholderProps>;
|
|
9
|
+
};
|
|
10
|
+
export declare const Video: ({ kind, participant, className, setVideoElementRef, VideoPlaceholder, ...rest }: VideoProps) => JSX.Element | null;
|
|
@@ -13,15 +13,17 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
13
13
|
import { useCallback, useEffect, useRef, useState, } from 'react';
|
|
14
14
|
import { DebounceType, SfuModels, VisibilityState, } from '@stream-io/video-client';
|
|
15
15
|
import clsx from 'clsx';
|
|
16
|
-
import { VideoPlaceholder } from './VideoPlaceholder';
|
|
16
|
+
import { VideoPlaceholder as DefaultVideoPlaceholder, } from './VideoPlaceholder';
|
|
17
17
|
import { BaseVideo } from './BaseVideo';
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
import { useCall } from '@stream-io/video-react-bindings';
|
|
19
|
+
export const Video = (_a) => {
|
|
20
|
+
var { kind, participant, className, setVideoElementRef, VideoPlaceholder = DefaultVideoPlaceholder } = _a, rest = __rest(_a, ["kind", "participant", "className", "setVideoElementRef", "VideoPlaceholder"]);
|
|
21
|
+
const { sessionId, videoStream, screenShareStream, publishedTracks, viewportVisibilityState, isLoggedInUser, userId, } = participant;
|
|
22
|
+
const call = useCall();
|
|
21
23
|
const [videoElement, setVideoElement] = useState(null);
|
|
22
24
|
// const [videoTrackMuted, setVideoTrackMuted] = useState(false);
|
|
23
25
|
const [videoPlaying, setVideoPlaying] = useState(false);
|
|
24
|
-
const viewportVisibilityRef = useRef(
|
|
26
|
+
const viewportVisibilityRef = useRef(viewportVisibilityState);
|
|
25
27
|
const stream = kind === 'video' ? videoStream : screenShareStream;
|
|
26
28
|
// TODO: handle track muting
|
|
27
29
|
// useEffect(() => {
|
|
@@ -45,24 +47,25 @@ export const Video = (props) => {
|
|
|
45
47
|
? SfuModels.TrackType.VIDEO
|
|
46
48
|
: SfuModels.TrackType.SCREEN_SHARE);
|
|
47
49
|
const displayPlaceholder = !isPublishingTrack ||
|
|
48
|
-
(
|
|
50
|
+
(viewportVisibilityState === VisibilityState.INVISIBLE &&
|
|
49
51
|
!screenShareStream) ||
|
|
50
52
|
!videoPlaying;
|
|
51
53
|
const lastDimensionRef = useRef();
|
|
52
54
|
const updateSubscription = useCallback((dimension, type = DebounceType.SLOW) => {
|
|
55
|
+
if (!call)
|
|
56
|
+
return;
|
|
53
57
|
call.updateSubscriptionsPartial(kind, {
|
|
54
58
|
[sessionId]: {
|
|
55
59
|
dimension,
|
|
56
60
|
},
|
|
57
61
|
}, type);
|
|
58
62
|
}, [call, kind, sessionId]);
|
|
59
|
-
// handle generic subscription updates
|
|
60
63
|
// handle visibility subscription updates
|
|
61
64
|
useEffect(() => {
|
|
62
|
-
viewportVisibilityRef.current =
|
|
63
|
-
if (!videoElement || !isPublishingTrack ||
|
|
65
|
+
viewportVisibilityRef.current = viewportVisibilityState;
|
|
66
|
+
if (!videoElement || !isPublishingTrack || isLoggedInUser)
|
|
64
67
|
return;
|
|
65
|
-
const isInvisibleVVS =
|
|
68
|
+
const isInvisibleVVS = viewportVisibilityState === VisibilityState.INVISIBLE;
|
|
66
69
|
updateSubscription(isInvisibleVVS
|
|
67
70
|
? undefined
|
|
68
71
|
: {
|
|
@@ -71,14 +74,14 @@ export const Video = (props) => {
|
|
|
71
74
|
}, DebounceType.MEDIUM);
|
|
72
75
|
}, [
|
|
73
76
|
updateSubscription,
|
|
74
|
-
|
|
77
|
+
viewportVisibilityState,
|
|
75
78
|
videoElement,
|
|
76
79
|
isPublishingTrack,
|
|
77
|
-
|
|
80
|
+
isLoggedInUser,
|
|
78
81
|
]);
|
|
79
82
|
// handle resize subscription updates
|
|
80
83
|
useEffect(() => {
|
|
81
|
-
if (!videoElement || !isPublishingTrack ||
|
|
84
|
+
if (!videoElement || !isPublishingTrack || isLoggedInUser)
|
|
82
85
|
return;
|
|
83
86
|
const resizeObserver = new ResizeObserver(() => {
|
|
84
87
|
const currentDimensions = `${videoElement.clientWidth},${videoElement.clientHeight}`;
|
|
@@ -102,12 +105,13 @@ export const Video = (props) => {
|
|
|
102
105
|
}, [
|
|
103
106
|
updateSubscription,
|
|
104
107
|
videoElement,
|
|
105
|
-
|
|
108
|
+
viewportVisibilityState,
|
|
106
109
|
isPublishingTrack,
|
|
107
|
-
|
|
110
|
+
isLoggedInUser,
|
|
108
111
|
]);
|
|
112
|
+
// handle generic subscription updates
|
|
109
113
|
useEffect(() => {
|
|
110
|
-
if (!isPublishingTrack || !videoElement ||
|
|
114
|
+
if (!isPublishingTrack || !videoElement || isLoggedInUser)
|
|
111
115
|
return;
|
|
112
116
|
updateSubscription({
|
|
113
117
|
height: videoElement.clientHeight,
|
|
@@ -116,12 +120,7 @@ export const Video = (props) => {
|
|
|
116
120
|
return () => {
|
|
117
121
|
updateSubscription(undefined, DebounceType.FAST);
|
|
118
122
|
};
|
|
119
|
-
}, [
|
|
120
|
-
updateSubscription,
|
|
121
|
-
videoElement,
|
|
122
|
-
isPublishingTrack,
|
|
123
|
-
participant.isLoggedInUser,
|
|
124
|
-
]);
|
|
123
|
+
}, [updateSubscription, videoElement, isPublishingTrack, isLoggedInUser]);
|
|
125
124
|
const [isWideMode, setIsWideMode] = useState(true);
|
|
126
125
|
useEffect(() => {
|
|
127
126
|
if (!stream || !videoElement)
|
|
@@ -140,10 +139,13 @@ export const Video = (props) => {
|
|
|
140
139
|
videoElement.removeEventListener('play', calculateVideoRatio);
|
|
141
140
|
};
|
|
142
141
|
}, [stream, videoElement]);
|
|
143
|
-
|
|
144
|
-
|
|
142
|
+
if (!call)
|
|
143
|
+
return null;
|
|
144
|
+
return (_jsxs(_Fragment, { children: [_jsx(BaseVideo, Object.assign({}, rest, { stream: stream, className: clsx(className, 'str-video__video', {
|
|
145
145
|
'str-video__video--tall': !isWideMode,
|
|
146
|
-
|
|
146
|
+
'str-video__video--mirror': isLoggedInUser && kind === 'video',
|
|
147
|
+
'str-video__video--screen-share': kind === 'screen',
|
|
148
|
+
}), "data-user-id": userId, "data-session-id": sessionId, ref: (ref) => {
|
|
147
149
|
setVideoElement(ref);
|
|
148
150
|
setVideoElementRef === null || setVideoElementRef === void 0 ? void 0 : setVideoElementRef(ref);
|
|
149
151
|
} })), displayPlaceholder && (_jsx(VideoPlaceholder, { style: { position: 'absolute' }, participant: participant, ref: setVideoElementRef }))] }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Video.js","sourceRoot":"","sources":["../../../../../src/core/components/Video/Video.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAEL,WAAW,EACX,SAAS,EACT,MAAM,EACN,QAAQ,GAET,MAAM,OAAO,CAAC;AACf,OAAO,
|
|
1
|
+
{"version":3,"file":"Video.js","sourceRoot":"","sources":["../../../../../src/core/components/Video/Video.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAEL,WAAW,EACX,SAAS,EACT,MAAM,EACN,QAAQ,GAET,MAAM,OAAO,CAAC;AACf,OAAO,EACL,YAAY,EACZ,SAAS,EAET,eAAe,GAChB,MAAM,yBAAyB,CAAC;A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