Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

feat(SS): pass the source type to lib-jitsi-meet.

hristoterezov1a9a8a2098c4
diff --git a/conference.js b/conference.js
index eac57d54af..a2c08d21e4 100644
--- a/conference.js
+++ b/conference.js
@@ -2129,5 +2129,17 @@ export default {
*/
getDesktopSharingSourceId() {
return localVideo.sourceId;
+ },
+
+ /**
+ * Returns the desktop sharing source type or undefined if the desktop
+ * sharing is not active at the moment.
+ *
+ * @returns {'screen'|'window'|undefined} - The source type. If the track is
+ * not desktop track or the source type is not available, undefined will be
+ * returned.
+ */
+ getDesktopSharingSourceType() {
+ return localVideo.sourceType;
}
};
diff --git a/react/features/desktop-picker/components/DesktopPicker.js b/react/features/desktop-picker/components/DesktopPicker.js
index f734e4e6c8..318d6a5c68 100644
--- a/react/features/desktop-picker/components/DesktopPicker.js
+++ b/react/features/desktop-picker/components/DesktopPicker.js
@@ -85,7 +85,7 @@ class DesktopPicker extends Component {
super(props);
this.state = {
- selectedSourceId: ''
+ selectedSource: {}
};
this._poller = null;
@@ -116,10 +116,13 @@ class DesktopPicker extends Component {
* @returns {void}
*/
componentWillReceiveProps(nextProps) {
- if (!this.state.selectedSourceId
+ if (!this.state.selectedSource.id
&& nextProps.sources.screen.length) {
this.setState({
- selectedSourceId: nextProps.sources.screen[0].id
+ selectedSource: {
+ id: nextProps.sources.screen[0].id,
+ type: 'screen'
+ }
});
}
}
@@ -155,14 +158,16 @@ class DesktopPicker extends Component {
/**
* Dispatches an action to hide the DesktopPicker and invokes the passed in
- * callback with a selectedSourceId, if any.
+ * callback with a selectedSource, if any.
*
* @param {string} id - The id of the DesktopCapturerSource to pass into the
* onSourceChoose callback.
+ * @param {string} type - The type of the DesktopCapturerSource to pass into
+ * the onSourceChoose callback.
* @returns {void}
*/
- _onCloseModal(id = '') {
- this.props.onSourceChoose(id);
+ _onCloseModal(id, type) {
+ this.props.onSourceChoose(id, type);
this.props.dispatch(hideDialog());
}
@@ -170,10 +175,16 @@ class DesktopPicker extends Component {
* Sets the currently selected DesktopCapturerSource.
*
* @param {string} id - The id of DesktopCapturerSource.
+ * @param {string} type - The type of DesktopCapturerSource.
* @returns {void}
*/
- _onPreviewClick(id) {
- this.setState({ selectedSourceId: id });
+ _onPreviewClick(id, type) {
+ this.setState({
+ selectedSource: {
+ id,
+ type
+ }
+ });
}
/**
@@ -183,7 +194,9 @@ class DesktopPicker extends Component {
* @returns {void}
*/
_onSubmit() {
- this._onCloseModal(this.state.selectedSourceId);
+ const { id, type } = this.state.selectedSource;
+
+ this._onCloseModal(id, type);
}
/**
@@ -193,7 +206,7 @@ class DesktopPicker extends Component {
* @returns {ReactElement}
*/
_renderTabs() {
- const { selectedSourceId } = this.state;
+ const { selectedSource } = this.state;
const { sources, t } = this.props;
const tabs
= TABS_TO_POPULATE.map(({ defaultSelected, label, type }) => {
@@ -202,7 +215,7 @@ class DesktopPicker extends Component {
key = { type }
onClick = { this._onPreviewClick }
onDoubleClick = { this._onCloseModal }
- selectedSourceId = { selectedSourceId }
+ selectedSourceId = { selectedSource.id }
sources = { sources[type] || [] }
type = { type } />,
defaultSelected,
diff --git a/react/features/desktop-picker/components/DesktopPickerPane.js b/react/features/desktop-picker/components/DesktopPickerPane.js
index e4d1d1d9e5..2112f0a13c 100644
--- a/react/features/desktop-picker/components/DesktopPickerPane.js
+++ b/react/features/desktop-picker/components/DesktopPickerPane.js
@@ -66,7 +66,8 @@ class DesktopPickerPane extends Component {
onClick = { onClick }
onDoubleClick = { onDoubleClick }
selected = { source.id === selectedSourceId }
- source = { source } />);
+ source = { source }
+ type = { type } />);
return (
<div className = { classNames }>
diff --git a/react/features/desktop-picker/components/DesktopSourcePreview.js b/react/features/desktop-picker/components/DesktopSourcePreview.js
index 76394f1a71..4b9a867061 100644
--- a/react/features/desktop-picker/components/DesktopSourcePreview.js
+++ b/react/features/desktop-picker/components/DesktopSourcePreview.js
@@ -34,7 +34,12 @@ class DesktopSourcePreview extends Component {
/**
* The DesktopCapturerSource to display.
*/
- source: React.PropTypes.object
+ source: React.PropTypes.object,
+
+ /**
+ * The source type of the DesktopCapturerSources to display.
+ */
+ type: React.PropTypes.string
};
/**
@@ -83,7 +88,9 @@ class DesktopSourcePreview extends Component {
* @returns {void}
*/
_onClick() {
- this.props.onClick(this.props.source.id);
+ const { source, type } = this.props;
+
+ this.props.onClick(source.id, type);
}
/**
@@ -92,7 +99,9 @@ class DesktopSourcePreview extends Component {
* @returns {void}
*/
_onDoubleClick() {
- this.props.onDoubleClick(this.props.source.id);
+ const { source, type } = this.props;
+
+ this.props.onDoubleClick(source.id, type);
}
}