Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Commit 11c4362

Browse files
committed
Set stop function optional
1 parent 20acd22 commit 11c4362

7 files changed

+11
-11
lines changed

src/components/AudioDevicePanel.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { TrackSource } from "../containers/Client";
77
type AudioDevicePanelProps = {
88
deviceId: string;
99
label: string;
10-
addLocalAudioStream: (stream: MediaStream, id: string, source: TrackSource, stop: () => void) => void;
10+
addLocalAudioStream: (stream: MediaStream, id: string, source: TrackSource, stop?: () => void) => void;
1111
setSelectedAudioId: (cameraId: DeviceInfo | null) => void;
1212
selected: boolean;
1313
};
@@ -24,7 +24,7 @@ export const AudioDevicePanel = ({
2424
const id = deviceId + uuidv4();
2525
getUserMedia(id, "audio").then((stream) => {
2626
setSelectedAudioId({ id: id, type: "audio", stream: stream });
27-
addLocalAudioStream(stream, id, "navigator", () => {});
27+
addLocalAudioStream(stream, id, "navigator");
2828
});
2929
}}
3030
>

src/components/MockVideoPanel.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { TrackSource } from "../containers/Client";
1212

1313
type MockVideoPanelProps = {
1414
id: string;
15-
addLocalVideoStream: (stream: MediaStream, id: string, source: TrackSource, stop: () => void) => void;
15+
addLocalVideoStream: (stream: MediaStream, id: string, source: TrackSource, stop?: () => void) => void;
1616
selectedDeviceId: DeviceInfo | null;
1717
setSelectedDeviceId: (info: DeviceInfo | null) => void;
1818
};

src/components/ScreensharingPanel.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { v4 as uuidv4 } from "uuid";
66
import { TrackSource } from "../containers/Client";
77

88
type ScreensharingPanelProps = {
9-
addLocalStream: (stream: MediaStream, id: string, source: TrackSource, stop: () => void) => void;
9+
addLocalStream: (stream: MediaStream, id: string, source: TrackSource, stop?: () => void) => void;
1010
label: string;
1111
setSelectedDeviceId: (trackId: DeviceInfo | null) => void;
1212
};
@@ -36,9 +36,9 @@ export const ScreensharingPanel = ({ label, addLocalStream, setSelectedDeviceId
3636
const videoStream = new MediaStream(stream.getVideoTracks());
3737
const audioStream = new MediaStream(stream.getAudioTracks());
3838
setSelectedDeviceId({ id: videoId, type: "screenshare", stream: videoStream });
39-
addLocalStream(videoStream, videoId, "navigator", () => {});
39+
addLocalStream(videoStream, videoId, "navigator");
4040
if (screenshareAudio) {
41-
addLocalStream(audioStream, audioId, "navigator", () => {});
41+
addLocalStream(audioStream, audioId, "navigator");
4242
}
4343
});
4444
} else {

src/components/StreamingDeviceSelector.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ type StreamingDeviceSelectorProps = {
2121
id: string;
2222
selectedDeviceId: DeviceInfo | null;
2323
setSelectedDeviceId: (info: DeviceInfo | null) => void;
24-
addLocalStream: (stream: MediaStream, id: string, source: TrackSource, stop: () => void) => void;
24+
addLocalStream: (stream: MediaStream, id: string, source: TrackSource, stop?: () => void) => void;
2525
};
2626

2727
const widthAtom = atomWithStorage("width-constraint", 1280);

src/components/VideoDevicePanel.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { showToastInfo } from "./Toasts";
88
type VideoDevicePanelProps = {
99
deviceId: string;
1010
label: string;
11-
addLocalVideoStream: (stream: MediaStream, id: string, source: TrackSource, stop: () => void) => void;
11+
addLocalVideoStream: (stream: MediaStream, id: string, source: TrackSource, stop?: () => void) => void;
1212
setSelectedVideoId: (cameraId: DeviceInfo | null) => void;
1313
selected: boolean;
1414
constraints?: MediaTrackConstraints;
@@ -49,7 +49,7 @@ export const VideoDevicePanel = ({
4949
})
5050
.then((stream) => {
5151
setSelectedVideoId({ id: id, type: "video", stream });
52-
addLocalVideoStream(stream, id, "navigator", () => {});
52+
addLocalVideoStream(stream, id, "navigator");
5353
})
5454
.catch(() => {
5555
setActiveLocalCameras((prev) => prev - 1);

src/containers/Client.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ export const Client = ({ roomId, peerId, token, id, refetchIfNeeded, remove, rem
118118
}
119119
};
120120

121-
const addLocalStream = (stream: MediaStream, id: string, source: "mock" | "navigator", stop: () => void) => {
121+
const addLocalStream = (stream: MediaStream, id: string, source: "mock" | "navigator", stop?: () => void) => {
122122
stream.getVideoTracks().forEach((track) => {
123123
if (id.includes("screenshare")) {
124124
dispatch({

src/containers/StreamingSettingsCard.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ type StreamingSettingsCardProps = {
2222
setMaxBandwidth: (value: string | null) => void;
2323
attachMetadata: boolean;
2424
setAttachMetadata: (value: boolean) => void;
25-
addLocalStream: (stream: MediaStream, id: string, source: TrackSource, stop: () => void) => void;
25+
addLocalStream: (stream: MediaStream, id: string, source: TrackSource, stop?: () => void) => void;
2626
currentEncodings: TrackEncoding[];
2727
setCurrentEncodings: (value: TrackEncoding[]) => void;
2828
addAudioTrack: (trackInfo: DeviceInfo) => void;

0 commit comments

Comments
 (0)