add screen share off sound notification

This commit is contained in:
KDSBrowne 2019-04-14 23:27:18 +00:00
parent e33e336854
commit a90c39af3f
3 changed files with 28 additions and 20 deletions

View File

@ -41,10 +41,10 @@ const intlMessages = defineMessages({
}); });
const BROWSER_RESULTS = browser(); const BROWSER_RESULTS = browser();
const isMobileBrowser = (BROWSER_RESULTS ? BROWSER_RESULTS.mobile : false) || const isMobileBrowser = (BROWSER_RESULTS ? BROWSER_RESULTS.mobile : false)
(BROWSER_RESULTS && BROWSER_RESULTS.os ? || (BROWSER_RESULTS && BROWSER_RESULTS.os
BROWSER_RESULTS.os.includes('Android') : // mobile flag doesn't always work ? BROWSER_RESULTS.os.includes('Android') // mobile flag doesn't always work
false); : false);
const ICE_CONNECTION_FAILED = 'ICE connection failed'; const ICE_CONNECTION_FAILED = 'ICE connection failed';
@ -66,23 +66,28 @@ const DesktopShare = ({
default: default:
logger.error({ logCode: 'desktopshare_default_error' }, error || 'Default error handler'); logger.error({ logCode: 'desktopshare_default_error' }, error || 'Default error handler');
} }
const audioAlert = new Audio(`${Meteor.settings.public.app.cdn + Meteor.settings.public.app.basename}/resources/sounds/ScreenshareOff.mp3`);
audioAlert.play();
}; };
return (screenSharingCheck && !isMobileBrowser && isUserPresenter ? return (screenSharingCheck && !isMobileBrowser && isUserPresenter
<Button ? (
className={cx(styles.button, isVideoBroadcasting || styles.btn)} <Button
icon={isVideoBroadcasting ? 'desktop' : 'desktop_off'} className={cx(styles.button, isVideoBroadcasting || styles.btn)}
label={intl.formatMessage(isVideoBroadcasting ? icon={isVideoBroadcasting ? 'desktop' : 'desktop_off'}
intlMessages.stopDesktopShareLabel : intlMessages.desktopShareLabel)} label={intl.formatMessage(isVideoBroadcasting
description={intl.formatMessage(isVideoBroadcasting ? ? intlMessages.stopDesktopShareLabel : intlMessages.desktopShareLabel)}
intlMessages.stopDesktopShareDesc : intlMessages.desktopShareDesc)} description={intl.formatMessage(isVideoBroadcasting
color={isVideoBroadcasting ? 'primary' : 'default'} ? intlMessages.stopDesktopShareDesc : intlMessages.desktopShareDesc)}
ghost={!isVideoBroadcasting} color={isVideoBroadcasting ? 'primary' : 'default'}
hideLabel ghost={!isVideoBroadcasting}
circle hideLabel
size="lg" circle
onClick={isVideoBroadcasting ? handleUnshareScreen : () => handleShareScreen(onFail)} size="lg"
id={isVideoBroadcasting ? 'unshare-screen-button' : 'share-screen-button'} onClick={isVideoBroadcasting ? handleUnshareScreen : () => handleShareScreen(onFail)}
/> id={isVideoBroadcasting ? 'unshare-screen-button' : 'share-screen-button'}
/>
)
: null); : null);
}; };

View File

@ -19,6 +19,7 @@ class ScreenshareComponent extends React.Component {
loaded: false, loaded: false,
}; };
this.audioAlert = new Audio(`${Meteor.settings.public.app.cdn + Meteor.settings.public.app.basename}/resources/sounds/ScreenshareOff.mp3`);
this.onVideoLoad = this.onVideoLoad.bind(this); this.onVideoLoad = this.onVideoLoad.bind(this);
} }
@ -31,6 +32,7 @@ class ScreenshareComponent extends React.Component {
const { isPresenter, unshareScreen } = this.props; const { isPresenter, unshareScreen } = this.props;
if (isPresenter && !nextProps.isPresenter) { if (isPresenter && !nextProps.isPresenter) {
unshareScreen(); unshareScreen();
this.audioAlert.play();
} }
} }
@ -38,6 +40,7 @@ class ScreenshareComponent extends React.Component {
const { presenterScreenshareHasEnded, unshareScreen } = this.props; const { presenterScreenshareHasEnded, unshareScreen } = this.props;
presenterScreenshareHasEnded(); presenterScreenshareHasEnded();
unshareScreen(); unshareScreen();
this.audioAlert.play();
} }
onVideoLoad() { onVideoLoad() {