@100mslive/roomkit-react 0.2.7-alpha.2 → 0.2.7-alpha.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  import React, { Fragment } from 'react';
2
- import { selectIsAllowedToPublish, useHMSStore, useScreenShare } from '@100mslive/react-sdk';
2
+ import { selectIsAllowedToPublish, useAwayNotifications, useHMSStore, useScreenShare } from '@100mslive/react-sdk';
3
3
  import { ShareScreenIcon } from '@100mslive/react-icons';
4
4
  import { ShareScreenOptions } from './pdfAnnotator/shareScreenOptions';
5
5
  import { Box, Flex } from '../../Layout';
@@ -14,6 +14,7 @@ export const ScreenshareToggle = ({ css = {} }) => {
14
14
  const isAudioOnly = useUISettings(UI_SETTINGS.isAudioOnly);
15
15
 
16
16
  const { amIScreenSharing, screenShareVideoTrackId: video, toggleScreenShare } = useScreenShare();
17
+ const { requestPermission } = useAwayNotifications();
17
18
  const isVideoScreenshare = amIScreenSharing && !!video;
18
19
  if (!isAllowedToPublish.screen || !isScreenshareSupported()) {
19
20
  return null;
@@ -28,8 +29,9 @@ export const ScreenshareToggle = ({ css = {} }) => {
28
29
  active={!isVideoScreenshare}
29
30
  css={css}
30
31
  disabled={isAudioOnly}
31
- onClick={() => {
32
- toggleScreenShare();
32
+ onClick={async () => {
33
+ await toggleScreenShare();
34
+ await requestPermission();
33
35
  }}
34
36
  >
35
37
  <Tooltip title={`${!isVideoScreenshare ? 'Start' : 'Stop'} screen sharing`}>