Skip to content

Commit

Permalink
fix: lift the debug helpers from the SDK to Pronto
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverlaz committed Nov 6, 2023
1 parent 4fca13b commit c830713
Show file tree
Hide file tree
Showing 47 changed files with 415 additions and 308 deletions.
2 changes: 1 addition & 1 deletion packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"@protobuf-ts/runtime-rpc": "^2.9.1",
"@protobuf-ts/twirp-transport": "^2.9.1",
"@types/ws": "^8.5.7",
"axios": "^1.5.1",
"axios": "^1.6.0",
"base64-js": "^1.5.1",
"isomorphic-ws": "^5.0.0",
"jsonwebtoken": "^9.0.2",
Expand Down
8 changes: 0 additions & 8 deletions packages/client/src/Call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -701,14 +701,6 @@ export class Call {
throw error;
}

// FIXME OL: remove once cascading is implemented
if (typeof window !== 'undefined' && window.location?.search) {
const params = new URLSearchParams(window.location.search);
sfuServer.url = params.get('sfuUrl') || sfuServer.url;
sfuServer.ws_endpoint = params.get('sfuWsUrl') || sfuServer.ws_endpoint;
sfuServer.edge_name = params.get('sfuUrl') || sfuServer.edge_name;
}

const previousSfuClient = this.sfuClient;
const sfuClient = (this.sfuClient = new StreamSfuClient({
dispatcher: this.dispatcher,
Expand Down
5 changes: 3 additions & 2 deletions packages/client/src/devices/CameraManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ export class CameraManager extends InputMediaDeviceManager<CameraManagerState> {
}

/**
* Select the camera direaction
* @param direction
* Select the camera direction.
*
* @param direction the direction of the camera to select.
*/
async selectDirection(direction: Exclude<CameraDirection, undefined>) {
this.state.setDirection(direction);
Expand Down
33 changes: 0 additions & 33 deletions packages/client/src/rtc/flows/join.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,25 +44,6 @@ const doJoin = async (
...data,
location,
};

// FIXME OL: remove this once cascading is enabled by default
const cascadingModeParams = getCascadingModeParams();
if (cascadingModeParams) {
// FIXME OL: remove after SFU migration is done
if (data?.migrating_from && cascadingModeParams['next_sfu_id']) {
cascadingModeParams['sfu_id'] = cascadingModeParams['next_sfu_id'];
}
return httpClient.doAxiosRequest<JoinCallResponse, JoinCallRequest>(
'post',
`/call/${type}/${id}/join`,
request,
{
params: {
...cascadingModeParams,
},
},
);
}
return httpClient.post<JoinCallResponse, JoinCallRequest>(
`/call/${type}/${id}/join`,
request,
Expand All @@ -81,20 +62,6 @@ const toRtcConfiguration = (config?: ICEServer[]) => {
return rtcConfig;
};

const getCascadingModeParams = () => {
if (typeof window === 'undefined') return null;
const params = new URLSearchParams(window.location?.search);
const cascadingEnabled = params.get('cascading') !== null;
if (cascadingEnabled) {
const rawParams: Record<string, string> = {};
params.forEach((value, key) => {
rawParams[key] = value;
});
return rawParams;
}
return null;
};

/**
* Reconciles the local state of the source participant into the target participant.
*
Expand Down
1 change: 0 additions & 1 deletion packages/react-sdk/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ export * from '@stream-io/video-react-bindings';
export * from './src/core';

export * from './src/components';
export * from './src/types';
export * from './src/translations';
export {
useHorizontalScrollPosition,
Expand Down
2 changes: 1 addition & 1 deletion packages/react-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"CHANGELOG.md"
],
"dependencies": {
"@floating-ui/react": "^0.22.0",
"@floating-ui/react": "^0.26.1",
"@nivo/core": "^0.80.0",
"@nivo/line": "^0.80.0",
"@stream-io/video-client": "workspace:^",
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ export const PermissionRequests = () => {
OwnCapability.UPDATE_CALL_PERMISSIONS,
);

const localUserId = localParticipant?.userId;
useEffect(() => {
if (!call || !canUpdateCallPermissions) return;

const unsubscribe = call.on(
'call.permission_request',
(event: StreamVideoEvent) => {
if (event.type !== 'call.permission_request') return;

if (event.user.id !== localParticipant?.userId) {
if (event.user.id !== localUserId) {
setPermissionRequests((requests) =>
[...requests, event as PermissionRequestEvent].sort((a, b) =>
byNameOrId(a.user, b.user),
Expand All @@ -69,7 +69,7 @@ export const PermissionRequests = () => {
return () => {
unsubscribe();
};
}, [call, canUpdateCallPermissions, localParticipant]);
}, [call, canUpdateCallPermissions, localUserId]);

const handleUpdatePermission: HandleUpdatePermission = (request, type) => {
return async () => {
Expand Down
1 change: 1 addition & 0 deletions packages/react-sdk/src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export * from './CallControls';
export * from './CallParticipantsList';
export * from './CallPreview';
export * from './CallRecordingList';
export * from './CallStats';
export * from './DeviceSettings';
export * from './Icon';
export * from './LoadingIndicator';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ import {
ToggleMenuButtonProps,
} from '../../../components';
import { Reaction } from '../../../components/Reaction';

import { DebugParticipantPublishQuality } from '../../../components/Debug/DebugParticipantPublishQuality';
import { DebugStatsView } from '../../../components/Debug/DebugStatsView';
import { useIsDebugMode } from '../../../components/Debug/useIsDebugMode';
import { useParticipantViewContext } from './ParticipantViewContext';

export type DefaultParticipantViewUIProps = {
Expand Down Expand Up @@ -124,10 +120,10 @@ export const ParticipantDetails = ({
sessionId,
name,
userId,
videoStream,
} = participant;
const call = useCall()!;
const call = useCall();

const { t } = useI18n();
const connectionQualityAsString =
!!connectionQuality &&
SfuModels.ConnectionQuality[connectionQuality].toLowerCase();
Expand All @@ -136,16 +132,14 @@ export const ParticipantDetails = ({
const hasVideo = publishedTracks.includes(SfuModels.TrackType.VIDEO);
const canUnpin = !!pin && pin.isLocalPin;

const isDebugMode = useIsDebugMode();

return (
<div className="str-video__participant-details">
<span className="str-video__participant-details__name">
{name || userId}
{indicatorsVisible && isDominantSpeaker && (
<span
className="str-video__participant-details__name--dominant_speaker"
title="Dominant speaker"
title={t('Dominant speaker')}
/>
)}
{indicatorsVisible && (
Expand All @@ -154,7 +148,7 @@ export const ParticipantDetails = ({
isLocalParticipant &&
connectionQuality === SfuModels.ConnectionQuality.POOR
}
message="Poor connection quality. Please check your internet connection."
message={t('Poor connection quality')}
>
{connectionQualityAsString && (
<span
Expand All @@ -176,27 +170,13 @@ export const ParticipantDetails = ({
{indicatorsVisible && canUnpin && (
// TODO: remove this monstrosity once we have a proper design
<span
title="Unpin"
title={t('Unpin')}
onClick={() => call?.unpin(sessionId)}
style={{ cursor: 'pointer' }}
className="str-video__participant-details__name--pinned"
/>
)}
</span>
{isDebugMode && (
<>
<DebugParticipantPublishQuality
participant={participant}
call={call}
/>
<DebugStatsView
call={call}
sessionId={sessionId}
userId={userId}
mediaStream={videoStream}
/>
</>
)}
</div>
);
};
10 changes: 5 additions & 5 deletions packages/react-sdk/src/hooks/useFloatingUIPreset.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { useEffect } from 'react';
import type { UseFloatingData } from '@floating-ui/react';
import {
offset,
autoUpdate,
flip,
offset,
shift,
size,
useFloating,
shift,
flip,
} from '@floating-ui/react';
import type { UseFloatingProps } from '@floating-ui/react';

export const useFloatingUIPreset = ({
placement,
strategy,
}: Pick<UseFloatingProps, 'placement' | 'strategy'>) => {
}: Pick<UseFloatingData, 'placement' | 'strategy'>) => {
const {
refs,
x,
Expand Down
3 changes: 3 additions & 0 deletions packages/react-sdk/src/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@
"{{ direction }} fullscreen": "{{ direction }} fullscreen",
"{{ direction }} picture-in-picture": "{{ direction }} picture-in-picture",

"Dominant Speaker": "Dominant Speaker",
"Poor connection quality": "Poor connection quality. Please check your internet connection.",

"Participants": "Participants",
"Anonymous": ", and ({{ count }}) anonymous",
"No participants found": "No participants found",
Expand Down
7 changes: 0 additions & 7 deletions packages/react-sdk/src/types/components.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/react-sdk/src/types/index.ts

This file was deleted.

2 changes: 0 additions & 2 deletions packages/styling/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,3 @@
@import 'src/Tooltip';
@import 'src/Video';
@import 'src/VideoPreview';

@import './src/Debug';
9 changes: 0 additions & 9 deletions packages/styling/src/CallStats.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,6 @@
margin: unset;
}

&.str-video__call-stats-angular {
width: 400px;

canvas {
width: 400px;
height: 200px;
}
}

.str-video__call-stats__card-container {
--gap: 1rem;
display: flex;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
$scope-name: 'str-video__participant-view';

.str-video__participant-view,
.str-video__participant-view--angular-host {
.str-video__participant-view {
position: relative;
width: 100%;
max-width: 1280px;
Expand Down
8 changes: 0 additions & 8 deletions packages/styling/src/StreamCall.scss
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
.str-video__call-angular-host {
height: 100%;
max-height: 100%;
min-height: 0;
display: flex;
flex-direction: column;
}

.str-video__call {
background-color: var(--str-video__background-color2);
color: var(--str-video__text-color1);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import {
CallingState,
ChildrenOnly,
OwnCapability,
Restricted,
useCall,
useCallStateHooks,
} from '@stream-io/video-react-sdk';
import { useNavigate } from 'react-router-dom';
import { useJoinedCall } from '../../contexts';
import { PropsWithChildren } from 'react';

export const RoomAccessControls = () => {
const { setJoinedCall, joinedCall } = useJoinedCall();
Expand Down Expand Up @@ -91,7 +91,7 @@ export const RoomAccessControls = () => {
);
};

export const CloseInactiveRoomButton = ({ children }: ChildrenOnly) => {
export const CloseInactiveRoomButton = ({ children }: PropsWithChildren) => {
const navigate = useNavigate();
return (
<button
Expand Down
Loading

0 comments on commit c830713

Please sign in to comment.