diff --git a/bigbluebutton-client/resources/prod/lib/kurento-extension.js b/bigbluebutton-client/resources/prod/lib/kurento-extension.js index 3be2ef8b06d1b66a854c7450658202b5e1293127..08f97c574a1f90fc5de38a1279f803ddb112fb49 100644 --- a/bigbluebutton-client/resources/prod/lib/kurento-extension.js +++ b/bigbluebutton-client/resources/prod/lib/kurento-extension.js @@ -289,7 +289,7 @@ Kurento.prototype.onViewerIceCandidate = function(candidate) { type: 'screenshare', voiceBridge: kurentoHandler.voiceBridge, candidate : candidate, - callerIdName: kurentoHandler.caller_id_name + callerName: kurentoHandler.caller_id_name } console.log("this object " + JSON.stringify(this, null, 2)); kurentoHandler.sendMessage(message); diff --git a/bigbluebutton-html5/imports/api/2.0/screenshare/client/bridge/kurento.js b/bigbluebutton-html5/imports/api/2.0/screenshare/client/bridge/kurento.js index 6f632adfe27b4e4fb49fcb151e812d82708a6631..e5517ee22b83cf49774159f6e20d91661f7b2e2c 100755 --- a/bigbluebutton-html5/imports/api/2.0/screenshare/client/bridge/kurento.js +++ b/bigbluebutton-html5/imports/api/2.0/screenshare/client/bridge/kurento.js @@ -31,4 +31,16 @@ export default class KurentoScreenshareBridge { kurentoExitVideo() { window.kurentoExitVideo(); } + + // TODO parameters? que elementos? + kurentoShareScreen() { + window.kurentoShareScreen( + null, + BridgeService.getConferenceBridge(), + getUsername(), + getMeetingId(), + null, + null, + ); + } } diff --git a/bigbluebutton-html5/imports/ui/components/actions-bar/actions-dropdown/component.jsx b/bigbluebutton-html5/imports/ui/components/actions-bar/actions-dropdown/component.jsx index addc367de24b78f6a3a04810d45e536141800cb8..c0a8dbcf861c210cf719cda5a4f5c8a1ae55d603 100755 --- a/bigbluebutton-html5/imports/ui/components/actions-bar/actions-dropdown/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/actions-bar/actions-dropdown/component.jsx @@ -44,18 +44,21 @@ const presentation = () => { console.log('Should show the uploader component'); const polling = () => { console.log('Should initiate a polling'); }; -const shareScreen = () => { console.log('Should start screen sharing'); }; - class ActionsDropdown extends Component { constructor(props) { super(props); } render() { - const { intl, isUserPresenter } = this.props; + const { + intl, + isUserPresenter, + handleShareScreen, + } = this.props; + - // if (!isUserPresenter) return null; - return null; // temporarily disabling the functionality + if (!isUserPresenter) return null; + //return null; // temporarily disabling the functionality return ( <Dropdown ref={(ref) => { this._dropdown = ref; }}> @@ -90,7 +93,7 @@ class ActionsDropdown extends Component { icon="desktop" label={intl.formatMessage(intlMessages.desktopShareLabel)} description={intl.formatMessage(intlMessages.desktopShareDesc)} - onClick={shareScreen.bind(this)} + onClick={handleShareScreen} /> </DropdownList> </DropdownContent> diff --git a/bigbluebutton-html5/imports/ui/components/actions-bar/component.jsx b/bigbluebutton-html5/imports/ui/components/actions-bar/component.jsx index 31b73bb67719318aa38f1cfe07141de3a6a87a77..6a64d5cd14e2c0b6554eac2d0e2c702f63b81bcb 100644 --- a/bigbluebutton-html5/imports/ui/components/actions-bar/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/actions-bar/component.jsx @@ -11,12 +11,12 @@ export default class ActionsBar extends Component { } render() { - const { isUserPresenter } = this.props; + const { isUserPresenter, handleShareScreen } = this.props; return ( <div className={styles.actionsbar}> <div className={styles.left}> - <ActionsDropdown {...{ isUserPresenter }} /> + <ActionsDropdown {...{ isUserPresenter, handleShareScreen }} /> </div> <div className={styles.center}> <MuteAudioContainer /> diff --git a/bigbluebutton-html5/imports/ui/components/actions-bar/container.jsx b/bigbluebutton-html5/imports/ui/components/actions-bar/container.jsx index 9a19d36810b2a0c4098dca4581a42f0356cbbbaa..905dcf30fbd36839a39c9e3330180bc9c2a35c7b 100755 --- a/bigbluebutton-html5/imports/ui/components/actions-bar/container.jsx +++ b/bigbluebutton-html5/imports/ui/components/actions-bar/container.jsx @@ -4,6 +4,7 @@ import { withModalMounter } from '/imports/ui/components/modal/service'; import ActionsBar from './component'; import Service from './service'; import AudioService from '../audio/service'; +import ScreenshareService from '../screenshare/service'; import AudioModal from '../audio/audio-modal/component'; @@ -29,10 +30,12 @@ export default withModalMounter(createContainer(({ mountModal }) => { const handleExitAudio = () => AudioService.exitAudio(); const handleOpenJoinAudio = () => mountModal(<AudioModal handleJoinListenOnly={AudioService.joinListenOnly} />); + const handleShareScreen = () => ScreenshareService.shareScreen(); return { isUserPresenter: isPresenter, handleExitAudio, handleOpenJoinAudio, + handleShareScreen, }; }, ActionsBarContainer)); diff --git a/bigbluebutton-html5/imports/ui/components/screenshare/service.js b/bigbluebutton-html5/imports/ui/components/screenshare/service.js index 844f5eeea14344da0e36124f2d740c80e1447d04..4efce3811419226b66205105d2d013b94573edb5 100755 --- a/bigbluebutton-html5/imports/ui/components/screenshare/service.js +++ b/bigbluebutton-html5/imports/ui/components/screenshare/service.js @@ -32,6 +32,10 @@ function presenterScreenshareHasStarted() { KurentoBridge.kurentoWatchVideo(); } +const shareScreen = () => { + KurentoBridge.kurentoShareScreen(); +} + export { - isVideoBroadcasting, presenterScreenshareHasEnded, presenterScreenshareHasStarted, + isVideoBroadcasting, presenterScreenshareHasEnded, presenterScreenshareHasStarted, shareScreen, }; diff --git a/labs/kurento-screenshare/lib/ConnectionManager.js b/labs/kurento-screenshare/lib/ConnectionManager.js index 9fa2137872dae22aaf617c595bc6ff17be15bd7c..074569b04351f2fd1278d45774e613bce2aeedbc 100644 --- a/labs/kurento-screenshare/lib/ConnectionManager.js +++ b/labs/kurento-screenshare/lib/ConnectionManager.js @@ -82,7 +82,7 @@ module.exports = class ConnectionManager { let connectionId; let request = webSocket.upgradeReq; let sessionId; - let callerIdName; + let callerName; let response = { writeHead : {} }; @@ -161,7 +161,7 @@ module.exports = class ConnectionManager { console.log("[viewer] Session output \n " + session); if (message.sdpOffer && message.voiceBridge) { if (session) { - session._startViewer(webSocket, message.voiceBridge, message.sdpOffer, message.callerIdName, self._screenshareSessions[message.voiceBridge]._presenterEndpoint); + session._startViewer(webSocket, message.voiceBridge, message.sdpOffer, message.callerName, self._screenshareSessions[message.voiceBridge]._presenterEndpoint); } else { webSocket.sendMessage("voiceBridge not recognized"); webSocket.sendMessage(Object.keys(self._screenshareSessions)); @@ -199,7 +199,7 @@ module.exports = class ConnectionManager { case 'viewerIceCandidate': console.log("[viewerIceCandidate] Session output => " + session); if (session) { - session._onViewerIceCandidate(message.candidate, callerIdName); + session._onViewerIceCandidate(message.candidate, message.callerName); } else { console.log("[iceCandidate] Why is there no session on ICE CANDIDATE?"); } diff --git a/labs/kurento-screenshare/lib/screenshare.js b/labs/kurento-screenshare/lib/screenshare.js index d63a207ebcda3bdf0905b5a26e61b13ae7e190a9..49d73cdf17153d61a20752fcb4da64bb1f1b3281 100644 --- a/labs/kurento-screenshare/lib/screenshare.js +++ b/labs/kurento-screenshare/lib/screenshare.js @@ -60,24 +60,26 @@ module.exports = class Screenshare { } }; - _onViewerIceCandidate(_candidate, callerIdName) { + _onViewerIceCandidate(_candidate, callerName) { + console.log("onviewericecandidate callerName = " + callerName); let candidate = kurento.getComplexType('IceCandidate')(_candidate); - if (this._viewersEndpoint[callerIdName]) { - this._viewersEndpoint[callerIdName].addIceCandidate(candidate); + if (this._viewersEndpoint[callerName]) { + this._viewersEndpoint[callerName].addIceCandidate(candidate); } else { - if (!this._viewersCandidatesQueue[callerIdName]) { - this._viewersCandidatesQueue[callerIdName] = []; + if (!this._viewersCandidatesQueue[callerName]) { + this._viewersCandidatesQueue[callerName] = []; } - this._viewersCandidatesQueue[callerIdName].push(candidate); + this._viewersCandidatesQueue[callerName].push(candidate); } } - _startViewer(ws, voiceBridge, sdp, callerIdName, presenterEndpoint, callback) { + _startViewer(ws, voiceBridge, sdp, callerName, presenterEndpoint, callback) { let self = this; let _callback = function(){}; - self._viewersCandidatesQueue[callerIdName] = []; + console.log("startviewer callerName = " + callerName); + self._viewersCandidatesQueue[callerName] = []; console.log("VIEWER VOICEBRIDGE: "+self._voiceBridge); @@ -87,15 +89,15 @@ module.exports = class Screenshare { return _callback(error); } - self._viewersEndpoint[callerIdName] = webRtcEndpoint; + self._viewersEndpoint[callerName] = webRtcEndpoint; // QUEUES UP ICE CANDIDATES IF NEGOTIATION IS NOT YET READY - while(self._viewersCandidatesQueue[callerIdName].length) { - let candidate = self._viewersCandidatesQueue[callerIdName].shift(); - MediaController.addIceCandidate(self._viewersEndpoint[callerIdName].id, candidate); + while(self._viewersCandidatesQueue[callerName].length) { + let candidate = self._viewersCandidatesQueue[callerName].shift(); + MediaController.addIceCandidate(self._viewersEndpoint[callerName].id, candidate); } // CONNECTS TWO MEDIA ELEMENTS - MediaController.connectMediaElements(presenterEndpoint.id, self._viewersEndpoint[callerIdName].id, C.VIDEO, function(error) { + MediaController.connectMediaElements(presenterEndpoint.id, self._viewersEndpoint[callerName].id, C.VIDEO, function(error) { if (error) { console.log("Media elements CONNECT error " + error); //pipeline.release(); @@ -104,7 +106,7 @@ module.exports = class Screenshare { }); // ICE NEGOTIATION WITH THE ENDPOINT - self._viewersEndpoint[callerIdName].on('OnIceCandidate', function(event) { + self._viewersEndpoint[callerName].on('OnIceCandidate', function(event) { let candidate = kurento.getComplexType('IceCandidate')(event.candidate); ws.sendMessage({ id : 'iceCandidate', candidate : candidate }); }); @@ -118,14 +120,14 @@ module.exports = class Screenshare { return _callback(error); } ws.sendMessage({id: "viewerResponse", sdpAnswer: webRtcSdpAnswer, response: "accepted"}); - console.log(" Sent sdp message to client with callerIdName:" + callerIdName); + console.log(" Sent sdp message to client with callerName:" + callerName); MediaController.gatherCandidates(webRtcEndpoint.id, function(error) { if (error) { return _callback(error); } - self._viewersEndpoint[callerIdName].on('MediaFlowInStateChange', function(event) { + self._viewersEndpoint[callerName].on('MediaFlowInStateChange', function(event) { if (event.state === 'NOT_FLOWING') { console.log(" NOT FLOWING "); }