Merge pull request #8379 from horymury/hmuresan/broadcast-screenshare
feat(external_api) add command and event listener for CS
This commit is contained in:
commit
7f1894dd57
|
@ -432,6 +432,15 @@ function initCommands() {
|
|||
case 'is-sharing-screen':
|
||||
callback(Boolean(APP.conference.isSharingScreen));
|
||||
break;
|
||||
case 'get-content-sharing-participants': {
|
||||
const tracks = getState()['features/base/tracks'];
|
||||
const sharingParticipantIds = tracks.filter(tr => tr.videoType === 'desktop').map(t => t.participantId);
|
||||
|
||||
callback({
|
||||
sharingParticipantIds
|
||||
});
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
@ -675,6 +684,19 @@ class API {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify external application (if API is enabled) that the list of sharing participants changed.
|
||||
*
|
||||
* @param {Object} data - The event data.
|
||||
* @returns {void}
|
||||
*/
|
||||
notifySharingParticipantsChanged(data: Object) {
|
||||
this._sendEvent({
|
||||
name: 'content-sharing-participants-changed',
|
||||
data
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify external application (if API is enabled) that the device list has
|
||||
* changed.
|
||||
|
|
|
@ -64,6 +64,7 @@ const events = {
|
|||
'audio-availability-changed': 'audioAvailabilityChanged',
|
||||
'audio-mute-status-changed': 'audioMuteStatusChanged',
|
||||
'camera-error': 'cameraError',
|
||||
'content-sharing-participants-changed': 'contentSharingParticipantsChanged',
|
||||
'device-list-changed': 'deviceListChanged',
|
||||
'display-name-change': 'displayNameChange',
|
||||
'email-change': 'emailChange',
|
||||
|
@ -725,6 +726,17 @@ export default class JitsiMeetExternalAPI extends EventEmitter {
|
|||
return getAvailableDevices(this._transport);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a list of the currently sharing participant id's.
|
||||
*
|
||||
* @returns {Promise} - Resolves with the list of participant id's currently sharing.
|
||||
*/
|
||||
getContentSharingParticipants() {
|
||||
return this._transport.sendRequest({
|
||||
name: 'get-content-sharing-participants'
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns Promise that resolves with current selected devices.
|
||||
*
|
||||
|
|
|
@ -35,6 +35,8 @@ import {
|
|||
setTrackMuted
|
||||
} from './functions';
|
||||
|
||||
import './subscriber';
|
||||
|
||||
declare var APP: Object;
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
// @flow
|
||||
|
||||
import _ from 'lodash';
|
||||
|
||||
import { StateListenerRegistry } from '../../base/redux';
|
||||
|
||||
declare var APP: Object;
|
||||
|
||||
/**
|
||||
* Notifies when the list of currently sharing participants changes.
|
||||
*/
|
||||
StateListenerRegistry.register(
|
||||
/* selector */ state =>
|
||||
state['features/base/tracks'].filter(tr => tr.videoType === 'desktop').map(t => t.participantId),
|
||||
/* listener */ (participantIDs, store, previousParticipantIDs) => {
|
||||
if (typeof APP !== 'object') {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_.isEqual(_.sortBy(participantIDs), _.sortBy(previousParticipantIDs))) {
|
||||
APP.API.notifySharingParticipantsChanged(participantIDs);
|
||||
}
|
||||
}
|
||||
);
|
Loading…
Reference in New Issue