|
@@ -1,15 +1,10 @@
|
|
-import { RequestDisplayMedia, screensharing } from '@andyet/simplewebrtc';
|
|
|
|
|
|
+import { RequestDisplayMedia } from '@andyet/simplewebrtc';
|
|
import ShareScreenIcon from 'material-icons-svg/components/baseline/ScreenShare';
|
|
import ShareScreenIcon from 'material-icons-svg/components/baseline/ScreenShare';
|
|
import React from 'react';
|
|
import React from 'react';
|
|
import styled from 'styled-components';
|
|
import styled from 'styled-components';
|
|
-import { buttonBase, TalkyButton } from '../styles/button';
|
|
|
|
|
|
+import { TalkyButton } from '../styles/button';
|
|
import mq from '../styles/media-queries';
|
|
import mq from '../styles/media-queries';
|
|
|
|
|
|
-const EXTENSION_ID =
|
|
|
|
- process.env.NODE_ENV === 'production'
|
|
|
|
- ? 'kochadnnpmbkfdhlaajaemgjmkjfhfkb'
|
|
|
|
- : 'ikljcimogjdaoojhmkbioipmffflodgk';
|
|
|
|
-
|
|
|
|
const Button = styled(TalkyButton)({
|
|
const Button = styled(TalkyButton)({
|
|
display: 'none',
|
|
display: 'none',
|
|
[mq.SMALL_DESKTOP]: {
|
|
[mq.SMALL_DESKTOP]: {
|
|
@@ -17,15 +12,6 @@ const Button = styled(TalkyButton)({
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
-const ButtonLink = styled.a({
|
|
|
|
- ...buttonBase,
|
|
|
|
- display: 'none',
|
|
|
|
- [mq.SMALL_DESKTOP]: {
|
|
|
|
- display: 'block'
|
|
|
|
- },
|
|
|
|
- alignItems: 'center'
|
|
|
|
-});
|
|
|
|
-
|
|
|
|
const EmptySpacer = styled.span({
|
|
const EmptySpacer = styled.span({
|
|
width: '120px'
|
|
width: '120px'
|
|
});
|
|
});
|
|
@@ -35,32 +21,17 @@ const EmptySpacer = styled.span({
|
|
// required by the user's browser.
|
|
// required by the user's browser.
|
|
const ScreenshareControls: React.SFC = () => (
|
|
const ScreenshareControls: React.SFC = () => (
|
|
<RequestDisplayMedia
|
|
<RequestDisplayMedia
|
|
- extensionId={EXTENSION_ID}
|
|
|
|
render={(getDisplayMedia, sharing) => {
|
|
render={(getDisplayMedia, sharing) => {
|
|
- if (sharing.ready) {
|
|
|
|
- return (
|
|
|
|
- <Button title="Screen Share" onClick={getDisplayMedia}>
|
|
|
|
- <ShareScreenIcon fill="#505658" />
|
|
|
|
- <span>Share screen</span>
|
|
|
|
- </Button>
|
|
|
|
- );
|
|
|
|
- }
|
|
|
|
- if (sharing.extensionRequired && !sharing.extensionInstalled) {
|
|
|
|
- return (
|
|
|
|
- <ButtonLink
|
|
|
|
- target="_blank"
|
|
|
|
- rel="noopener"
|
|
|
|
- onClick={() => sharing.listenForInstallation!()}
|
|
|
|
- href={screensharing.getExtensionURL(EXTENSION_ID)}
|
|
|
|
- >
|
|
|
|
- <ShareScreenIcon fill="#505658" />
|
|
|
|
- <span>Share screen</span>
|
|
|
|
- </ButtonLink>
|
|
|
|
- );
|
|
|
|
- }
|
|
|
|
if (!sharing.available) {
|
|
if (!sharing.available) {
|
|
return <EmptySpacer />;
|
|
return <EmptySpacer />;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ return (
|
|
|
|
+ <Button title="Screen Share" onClick={getDisplayMedia}>
|
|
|
|
+ <ShareScreenIcon fill="#505658" />
|
|
|
|
+ <span>Share screen</span>
|
|
|
|
+ </Button>
|
|
|
|
+ );
|
|
}}
|
|
}}
|
|
/>
|
|
/>
|
|
);
|
|
);
|