Switch to the new session
API for screen-sharing (#11266)
See https://github.com/electron/electron/pull/30702 - this has the benefit of the js-sdk and LiveKit not having to add custom logic for Electron Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
parent
2760bfc836
commit
cb03aac4cf
5 changed files with 5 additions and 137 deletions
|
@ -79,10 +79,10 @@ export class ExistingSource extends React.Component<ExistingSourceIProps> {
|
|||
export interface PickerIState {
|
||||
selectedTab: Tabs;
|
||||
sources: Array<DesktopCapturerSource>;
|
||||
selectedSource: DesktopCapturerSource | null;
|
||||
selectedSource?: DesktopCapturerSource;
|
||||
}
|
||||
export interface PickerIProps {
|
||||
onFinished(sourceId?: string): void;
|
||||
onFinished(source?: DesktopCapturerSource): void;
|
||||
}
|
||||
|
||||
type TabId = "screen" | "window";
|
||||
|
@ -96,7 +96,6 @@ export default class DesktopCapturerSourcePicker extends React.Component<PickerI
|
|||
this.state = {
|
||||
selectedTab: Tabs.Screens,
|
||||
sources: [],
|
||||
selectedSource: null,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -125,11 +124,11 @@ export default class DesktopCapturerSourcePicker extends React.Component<PickerI
|
|||
};
|
||||
|
||||
private onShare = (): void => {
|
||||
this.props.onFinished(this.state.selectedSource?.id);
|
||||
this.props.onFinished(this.state.selectedSource);
|
||||
};
|
||||
|
||||
private onTabChange = (): void => {
|
||||
this.setState({ selectedSource: null });
|
||||
this.setState({ selectedSource: undefined });
|
||||
};
|
||||
|
||||
private onCloseClick = (): void => {
|
||||
|
|
|
@ -30,12 +30,9 @@ import VideoFeed from "./VideoFeed";
|
|||
import RoomAvatar from "../avatars/RoomAvatar";
|
||||
import AccessibleButton from "../elements/AccessibleButton";
|
||||
import { avatarUrlForMember } from "../../../Avatar";
|
||||
import DesktopCapturerSourcePicker from "../elements/DesktopCapturerSourcePicker";
|
||||
import Modal from "../../../Modal";
|
||||
import LegacyCallViewSidebar from "./LegacyCallViewSidebar";
|
||||
import LegacyCallViewHeader from "./LegacyCallView/LegacyCallViewHeader";
|
||||
import LegacyCallViewButtons from "./LegacyCallView/LegacyCallViewButtons";
|
||||
import PlatformPeg from "../../../PlatformPeg";
|
||||
import { ActionPayload } from "../../../dispatcher/payloads";
|
||||
import { getKeyBindingsManager } from "../../../KeyBindingsManager";
|
||||
import { KeyBindingAction } from "../../../accessibility/KeyboardShortcuts";
|
||||
|
@ -289,17 +286,7 @@ export default class LegacyCallView extends React.Component<IProps, IState> {
|
|||
if (this.state.screensharing) {
|
||||
isScreensharing = await this.props.call.setScreensharingEnabled(false);
|
||||
} else {
|
||||
if (PlatformPeg.get()?.supportsDesktopCapturer()) {
|
||||
const { finished } = Modal.createDialog(DesktopCapturerSourcePicker);
|
||||
const [source] = await finished;
|
||||
if (!source) return;
|
||||
|
||||
isScreensharing = await this.props.call.setScreensharingEnabled(true, {
|
||||
desktopCapturerSourceId: source,
|
||||
});
|
||||
} else {
|
||||
isScreensharing = await this.props.call.setScreensharingEnabled(true);
|
||||
}
|
||||
isScreensharing = await this.props.call.setScreensharingEnabled(true);
|
||||
}
|
||||
|
||||
this.setState({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue