Skip to content

Commit

Permalink
Merge pull request bigbluebutton#7260 from KDSBrowne/2.2-play-audio-s…
Browse files Browse the repository at this point in the history
…creenshare-end

Add audible feedback when screen share ends
  • Loading branch information
antobinary authored Apr 22, 2019
2 parents ae0d979 + ea711de commit 2f6c73c
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class ActionsBar extends React.PureComponent {
currentSlidHasContent,
parseCurrentSlideContent,
isSharingVideo,
screenShareEndAlert,
} = this.props;

const {
Expand Down Expand Up @@ -89,6 +90,7 @@ class ActionsBar extends React.PureComponent {
isVideoBroadcasting,
isUserPresenter,
screenSharingCheck,
screenShareEndAlert,
}}
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ import PresentationService from '/imports/ui/components/presentation/service';
import ActionsBar from './component';
import Service from './service';
import VideoService from '../video-provider/service';
import { shareScreen, unshareScreen, isVideoBroadcasting } from '../screenshare/service';
import {
shareScreen, unshareScreen, isVideoBroadcasting, screenShareEndAlert,
} from '../screenshare/service';

import MediaService, { getSwapLayout } from '../media/service';

Expand All @@ -27,7 +29,6 @@ export default withTracker(() => {
},
});


return {
isUserPresenter: Service.isUserPresenter(),
isUserModerator: Service.isUserModerator(),
Expand All @@ -46,5 +47,6 @@ export default withTracker(() => {
currentSlidHasContent: PresentationService.currentSlidHasContent(),
parseCurrentSlideContent: PresentationService.parseCurrentSlideContent,
isSharingVideo: Service.isSharingVideo(),
screenShareEndAlert,
};
})(injectIntl(ActionsBarContainer));
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ const intlMessages = defineMessages({
});

const BROWSER_RESULTS = browser();
const isMobileBrowser = (BROWSER_RESULTS ? BROWSER_RESULTS.mobile : false) ||
(BROWSER_RESULTS && BROWSER_RESULTS.os ?
BROWSER_RESULTS.os.includes('Android') : // mobile flag doesn't always work
false);
const isMobileBrowser = (BROWSER_RESULTS ? BROWSER_RESULTS.mobile : false)
|| (BROWSER_RESULTS && BROWSER_RESULTS.os
? BROWSER_RESULTS.os.includes('Android') // mobile flag doesn't always work
: false);

const ICE_CONNECTION_FAILED = 'ICE connection failed';

Expand All @@ -55,6 +55,7 @@ const DesktopShare = ({
isVideoBroadcasting,
isUserPresenter,
screenSharingCheck,
screenShareEndAlert,
}) => {
const onFail = (error) => {
switch (error) {
Expand All @@ -66,23 +67,26 @@ const DesktopShare = ({
default:
logger.error({ logCode: 'desktopshare_default_error' }, error || 'Default error handler');
}
screenShareEndAlert();
};
return (screenSharingCheck && !isMobileBrowser && isUserPresenter ?
<Button
className={cx(styles.button, isVideoBroadcasting || styles.btn)}
icon={isVideoBroadcasting ? 'desktop' : 'desktop_off'}
label={intl.formatMessage(isVideoBroadcasting ?
intlMessages.stopDesktopShareLabel : intlMessages.desktopShareLabel)}
description={intl.formatMessage(isVideoBroadcasting ?
intlMessages.stopDesktopShareDesc : intlMessages.desktopShareDesc)}
color={isVideoBroadcasting ? 'primary' : 'default'}
ghost={!isVideoBroadcasting}
hideLabel
circle
size="lg"
onClick={isVideoBroadcasting ? handleUnshareScreen : () => handleShareScreen(onFail)}
id={isVideoBroadcasting ? 'unshare-screen-button' : 'share-screen-button'}
/>
return (screenSharingCheck && !isMobileBrowser && isUserPresenter
? (
<Button
className={cx(styles.button, isVideoBroadcasting || styles.btn)}
icon={isVideoBroadcasting ? 'desktop' : 'desktop_off'}
label={intl.formatMessage(isVideoBroadcasting
? intlMessages.stopDesktopShareLabel : intlMessages.desktopShareLabel)}
description={intl.formatMessage(isVideoBroadcasting
? intlMessages.stopDesktopShareDesc : intlMessages.desktopShareDesc)}
color={isVideoBroadcasting ? 'primary' : 'default'}
ghost={!isVideoBroadcasting}
hideLabel
circle
size="lg"
onClick={isVideoBroadcasting ? handleUnshareScreen : () => handleShareScreen(onFail)}
id={isVideoBroadcasting ? 'unshare-screen-button' : 'share-screen-button'}
/>
)
: null);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,18 @@ class ScreenshareComponent extends React.Component {
}

componentWillReceiveProps(nextProps) {
const { isPresenter, unshareScreen } = this.props;
const {
isPresenter, unshareScreen,
} = this.props;
if (isPresenter && !nextProps.isPresenter) {
unshareScreen();
}
}

componentWillUnmount() {
const { presenterScreenshareHasEnded, unshareScreen } = this.props;
const {
presenterScreenshareHasEnded, unshareScreen,
} = this.props;
presenterScreenshareHasEnded();
unshareScreen();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ import { withTracker } from 'meteor/react-meteor-data';
import Users from '/imports/api/users/';
import Auth from '/imports/ui/services/auth';
import mapUser from '/imports/ui/services/user/mapUser';
import { isVideoBroadcasting, presenterScreenshareHasEnded, unshareScreen,
presenterScreenshareHasStarted } from './service';
import {
isVideoBroadcasting, presenterScreenshareHasEnded, unshareScreen,
presenterScreenshareHasStarted,
} from './service';
import ScreenshareComponent from './component';

class ScreenshareContainer extends React.Component {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,16 @@ const shareScreen = (onFail) => {

const unshareScreen = () => {
KurentoBridge.kurentoExitScreenShare();
screenShareEndAlert();
};

const screenShareEndAlert = () => new Audio(`${Meteor.settings.public.app.cdn + Meteor.settings.public.app.basename}/resources/sounds/ScreenshareOff.mp3`).play();

export {
isVideoBroadcasting,
presenterScreenshareHasEnded,
presenterScreenshareHasStarted,
shareScreen,
unshareScreen,
screenShareEndAlert,
};
Binary file not shown.

0 comments on commit 2f6c73c

Please sign in to comment.