mirror of
https://github.com/element-hq/element-web.git
synced 2024-12-15 19:31:32 +03:00
Update thumbnails
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
parent
8f91b04eb3
commit
eca8ef3b35
2 changed files with 22 additions and 8 deletions
|
@ -513,8 +513,8 @@ export default class CallHandler {
|
||||||
call.placeScreenSharingCall(
|
call.placeScreenSharingCall(
|
||||||
remoteElement,
|
remoteElement,
|
||||||
localElement,
|
localElement,
|
||||||
async (sources: Array<DesktopCapturerSource>) : Promise<DesktopCapturerSource> => {
|
async () : Promise<DesktopCapturerSource> => {
|
||||||
const {finished} = Modal.createDialog(DesktopCapturerSourcePicker, {sources});
|
const {finished} = Modal.createDialog(DesktopCapturerSourcePicker);
|
||||||
const [source] = await finished;
|
const [source] = await finished;
|
||||||
return source;
|
return source;
|
||||||
});
|
});
|
||||||
|
|
|
@ -18,6 +18,7 @@ import React from 'react';
|
||||||
import { _t } from '../../../languageHandler';
|
import { _t } from '../../../languageHandler';
|
||||||
import BaseDialog from "..//dialogs/BaseDialog"
|
import BaseDialog from "..//dialogs/BaseDialog"
|
||||||
import AccessibleButton from './AccessibleButton';
|
import AccessibleButton from './AccessibleButton';
|
||||||
|
import {getDesktopCapturerSources} from "matrix-js-sdk/src/webrtc/call";
|
||||||
|
|
||||||
export enum Tabs {
|
export enum Tabs {
|
||||||
Screens = "screens",
|
Screens = "screens",
|
||||||
|
@ -56,24 +57,37 @@ export class ExistingSource extends React.Component<DesktopCapturerSourceIProps>
|
||||||
|
|
||||||
export interface DesktopCapturerSourcePickerIState {
|
export interface DesktopCapturerSourcePickerIState {
|
||||||
selectedTab: Tabs;
|
selectedTab: Tabs;
|
||||||
|
sources: Array<DesktopCapturerSource>;
|
||||||
}
|
}
|
||||||
export interface DesktopCapturerSourcePickerIProps {
|
export interface DesktopCapturerSourcePickerIProps {
|
||||||
sources: Array<DesktopCapturerSource>;
|
|
||||||
onFinished(source: DesktopCapturerSource): void;
|
onFinished(source: DesktopCapturerSource): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Figure out a way to update sources for live preview
|
|
||||||
|
|
||||||
export default class DesktopCapturerSourcePicker extends React.Component<
|
export default class DesktopCapturerSourcePicker extends React.Component<
|
||||||
DesktopCapturerSourcePickerIProps,
|
DesktopCapturerSourcePickerIProps,
|
||||||
DesktopCapturerSourcePickerIState
|
DesktopCapturerSourcePickerIState
|
||||||
> {
|
> {
|
||||||
|
interval;
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
selectedTab: Tabs.Screens,
|
selectedTab: Tabs.Screens,
|
||||||
}
|
sources: [],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
this.interval = setInterval(async () => {
|
||||||
|
this.setState({
|
||||||
|
sources: await getDesktopCapturerSources(),
|
||||||
|
});
|
||||||
|
}, 500);
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillUnmount() {
|
||||||
|
clearInterval(this.interval);
|
||||||
}
|
}
|
||||||
|
|
||||||
onSelect = (source) => {
|
onSelect = (source) => {
|
||||||
|
@ -95,7 +109,7 @@ export default class DesktopCapturerSourcePicker extends React.Component<
|
||||||
render() {
|
render() {
|
||||||
let sources;
|
let sources;
|
||||||
if (this.state.selectedTab === Tabs.Screens) {
|
if (this.state.selectedTab === Tabs.Screens) {
|
||||||
sources = this.props.sources
|
sources = this.state.sources
|
||||||
.filter((source) => {
|
.filter((source) => {
|
||||||
return source.id.startsWith("screen");
|
return source.id.startsWith("screen");
|
||||||
})
|
})
|
||||||
|
@ -103,7 +117,7 @@ export default class DesktopCapturerSourcePicker extends React.Component<
|
||||||
return <ExistingSource source={source} onSelect={this.onSelect} key={source.id} />;
|
return <ExistingSource source={source} onSelect={this.onSelect} key={source.id} />;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
sources = this.props.sources
|
sources = this.state.sources
|
||||||
.filter((source) => {
|
.filter((source) => {
|
||||||
return source.id.startsWith("window");
|
return source.id.startsWith("window");
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue