rename deskshare to screenshare and adjust condition for viewing

This commit is contained in:
Anton Georgiev 2017-07-24 15:29:34 -04:00
parent cacac6c9c6
commit b7d6427e63
16 changed files with 101 additions and 112 deletions

View File

@ -1,5 +0,0 @@
import VertoBridge from './verto';
const deskshareBridge = new VertoBridge();
export default deskshareBridge;

View File

@ -1,10 +0,0 @@
import Meetings from '/imports/api/1.1/meetings';
const getConferenceBridge = () => {
const Meeting = Meetings.findOne();
return Meeting.voiceConf;
};
export {
getConferenceBridge,
};

View File

@ -0,0 +1,5 @@
import VertoBridge from './verto';
const screenshareBridge = new VertoBridge();
export default screenshareBridge;

View File

@ -0,0 +1,7 @@
import Screenshare from '/imports/api/2.0/screenshare';
const getConferenceBridge = () => Screenshare.findOne().broadcast.screenshareConf;
export default {
getConferenceBridge,
};

View File

@ -1,4 +1,4 @@
import Users from '/imports/api/1.1/users';
import Users from '/imports/api/2.0/users';
import Auth from '/imports/ui/services/auth';
import { getConferenceBridge } from './service';
@ -9,14 +9,14 @@ const createVertoUserName = () => {
return `FreeSWITCH User - ${encodeURIComponent(uName)}`;
};
export default class VertoDeskshareBridge {
export default class VertoScreenshareBridge {
constructor() {
this.data = { getConferenceBridge };
}
vertoWatchVideo() {
window.vertoWatchVideo(
'deskshareVideo',
'screenshareVideo',
this.data.getConferenceBridge(),
createVertoUserName(),
null,

View File

@ -84,8 +84,8 @@ Base.propTypes = propTypes;
Base.defaultProps = defaultProps;
const SUBSCRIPTIONS_NAME = [
'users2x', 'users', 'chat', 'chat2x', 'cursor', 'cursor2x', 'deskshare', 'meetings', 'meetings2x',
'polls', 'polls2x', 'presentations', 'presentations2x', 'shapes', 'shapes2x', 'slides', 'slides2x', 'captions', 'captions2x', 'breakouts', 'breakouts2x',
'users2x', 'users', 'chat', 'chat2x', 'cursor', 'cursor2x', 'meetings', 'meetings2x',
'polls', 'polls2x', 'presentations', 'presentations2x', 'shapes', 'shapes2x', 'slides', 'slides2x', 'captions', 'captions2x', 'breakouts', 'breakouts2x', 'screenshare',
];
const BaseContainer = createContainer(({ params }) => {

View File

@ -1,13 +0,0 @@
import React from 'react';
export default class DeskshareComponent extends React.Component {
componentDidMount() {
this.props.presenterDeskshareHasStarted();
}
render() {
return (
<video id="deskshareVideo" style={{ height: '100%', width: '100%' }} />
);
}
}

View File

@ -1,29 +0,0 @@
import React from 'react';
import { isVideoBroadcasting, presenterDeskshareHasEnded,
presenterDeskshareHasStarted } from './service';
import { createContainer } from 'meteor/react-meteor-data';
import DeskshareComponent from './component';
class DeskshareContainer extends React.Component {
render() {
if (this.props.isVideoBroadcasting()) {
return <DeskshareComponent {...this.props} />;
}
}
componentWillUnmount() {
this.props.presenterDeskshareHasEnded();
}
}
export default createContainer(() => {
const data = {
isVideoBroadcasting,
presenterDeskshareHasStarted,
presenterDeskshareHasEnded,
};
return data;
}, DeskshareContainer);

View File

@ -1,36 +0,0 @@
import Deskshare from '/imports/api/1.1/deskshare';
import VertoBridge from '/imports/api/1.1/deskshare/client/bridge/verto';
import Auth from '/imports/ui/services/auth';
const vertoBridge = new VertoBridge();
// when the meeting information has been updated check to see if it was
// desksharing. If it has changed either trigger a call to receive video
// and display it, or end the call and hide the video
function isVideoBroadcasting() {
const ds = Deskshare.findOne({});
if (ds == null || !ds.broadcasting) {
return false;
}
return (ds.broadcasting && ds.startedBy != Auth.userID);
}
// if remote deskshare has been ended disconnect and hide the video stream
function presenterDeskshareHasEnded() {
// references a functiion in the global namespace inside verto_extension.js
// that we load dynamically
vertoBridge.vertoExitVideo();
}
// if remote deskshare has been started connect and display the video stream
function presenterDeskshareHasStarted() {
// references a functiion in the global namespace inside verto_extension.js
// that we load dynamically
vertoBridge.vertoWatchVideo();
}
export {
isVideoBroadcasting, presenterDeskshareHasEnded, presenterDeskshareHasStarted,
};

View File

@ -1,12 +1,10 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { createContainer } from 'meteor/react-meteor-data';
import Media from './component';
import MediaService from './service';
import Button from '../button/component';
import PresentationAreaContainer from '../presentation/container';
import VideoDockContainer from '../video-dock/container';
import DeskshareContainer from '../deskshare/container';
import ScreenshareContainer from '../screenshare/container';
import DefaultContent from '../presentation/default-content/component';
const defaultProps = {
@ -29,7 +27,7 @@ class MediaContainer extends Component {
}
componentWillReceiveProps(nextProps) {
if (nextProps.current_presentation != this.props.current_presentation) {
if (nextProps.current_presentation !== this.props.current_presentation) {
if (nextProps.current_presentation) {
this.setState({ content: this.props.content });
} else {
@ -64,8 +62,8 @@ export default createContainer(() => {
data.content = <PresentationAreaContainer />;
}
if (MediaService.shouldShowDeskshare()) {
data.content = <DeskshareContainer />;
if (MediaService.shouldShowScreenshare()) {
data.content = <ScreenshareContainer />;
}
if (MediaService.shouldShowOverlay()) {

View File

@ -1,5 +1,5 @@
import Presentations from '/imports/api/2.0/presentations';
import { isVideoBroadcasting } from '../deskshare/service';
import { isVideoBroadcasting } from '/imports/ui/components/screenshare/service';
const getPresentationInfo = () => {
const currentPresentation = Presentations.findOne({
@ -16,7 +16,7 @@ function shouldShowWhiteboard() {
return true;
}
function shouldShowDeskshare() {
function shouldShowScreenshare() {
return isVideoBroadcasting();
}
@ -27,6 +27,6 @@ function shouldShowOverlay() {
export default {
getPresentationInfo,
shouldShowWhiteboard,
shouldShowDeskshare,
shouldShowScreenshare,
shouldShowOverlay,
};

View File

@ -0,0 +1,13 @@
import React from 'react';
export default class ScreenshareComponent extends React.Component {
componentDidMount() {
this.props.presenterScreenshareHasStarted();
}
render() {
return (
<video id="screenshareVideo" style={{ height: '100%', width: '100%' }} />
);
}
}

View File

@ -0,0 +1,25 @@
import React from 'react';
import { createContainer } from 'meteor/react-meteor-data';
import { isVideoBroadcasting, presenterScreenshareHasEnded,
presenterScreenshareHasStarted } from './service';
import ScreenshareComponent from './component';
class ScreenshareContainer extends React.Component {
render() {
if (this.props.isVideoBroadcasting()) {
return <ScreenshareComponent {...this.props} />;
}
}
componentWillUnmount() {
this.props.presenterScreenshareHasEnded();
}
}
export default createContainer(() => ({
isVideoBroadcasting,
presenterScreenshareHasStarted,
presenterScreenshareHasEnded,
}), ScreenshareContainer);

View File

@ -0,0 +1,36 @@
import Screenshare from '/imports/api/2.0/screenshare';
import VertoBridge from '/imports/api/2.0/screenshare/client/bridge/verto';
import PresentationService from '/imports/ui/components/presentation/service';
const vertoBridge = new VertoBridge();
// when the meeting information has been updated check to see if it was
// screensharing. If it has changed either trigger a call to receive video
// and display it, or end the call and hide the video
function isVideoBroadcasting() {
const ds = Screenshare.findOne({});
// if (ds && ds.broadcast.stream) {
// return true;
// }
return (ds && ds.broadcast.stream && !PresentationService.isPresenter());
}
// if remote screenshare has been ended disconnect and hide the video stream
function presenterScreenshareHasEnded() {
// references a function in the global namespace inside verto_extension.js
// that we load dynamically
vertoBridge.vertoExitVideo();
}
// if remote screenshare has been started connect and display the video stream
function presenterScreenshareHasStarted() {
// references a function in the global namespace inside verto_extension.js
// that we load dynamically
vertoBridge.vertoWatchVideo();
}
export {
isVideoBroadcasting, presenterScreenshareHasEnded, presenterScreenshareHasStarted,
};

View File

@ -1,14 +1,12 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import ScreenshareContainer from '/imports/ui/components/screenshare/container';
import styles from './styles.scss';
import { FormattedMessage, FormattedDate } from 'react-intl';
import DeskshareContainer from '/imports/ui/components/deskshare/container.jsx';
export default class VideoDock extends Component {
render() {
return (
<div className={styles.videoDock}>
<DeskshareContainer />
<ScreenshareContainer />
</div>
);
}

View File

@ -3,7 +3,7 @@ acl:
subscriptions:
- 'users'
- 'cursor'
- 'deskshare'
- 'screenshare'
- 'meetings'
- 'polls'
- 'chat'