@100mslive/react-native-room-kit 1.0.1 → 1.0.2-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/HMSPrebuilt.js +16 -14
- package/lib/commonjs/HMSPrebuilt.js.map +1 -1
- package/lib/commonjs/HMSRoomSetup.js +85 -44
- package/lib/commonjs/HMSRoomSetup.js.map +1 -1
- package/lib/commonjs/Icons/Hand/assets/hand-off.png +0 -0
- package/lib/commonjs/Icons/Hand/assets/hand-off@2x.png +0 -0
- package/lib/commonjs/Icons/Hand/assets/hand-off@3x.png +0 -0
- package/lib/commonjs/Icons/Hand/index.js +2 -1
- package/lib/commonjs/Icons/Hand/index.js.map +1 -1
- package/lib/commonjs/Icons/Recording/assets/recording-off.png +0 -0
- package/lib/commonjs/Icons/Recording/assets/recording-off@2x.png +0 -0
- package/lib/commonjs/Icons/Recording/assets/recording-off@3x.png +0 -0
- package/lib/commonjs/Icons/Recording/index.js +2 -1
- package/lib/commonjs/Icons/Recording/index.js.map +1 -1
- package/lib/commonjs/components/DisplayView.js +3 -1
- package/lib/commonjs/components/DisplayView.js.map +1 -1
- package/lib/commonjs/components/EndRoomModal.js +29 -0
- package/lib/commonjs/components/EndRoomModal.js.map +1 -0
- package/lib/commonjs/components/EndRoomModalContent.js +9 -2
- package/lib/commonjs/components/EndRoomModalContent.js.map +1 -1
- package/lib/commonjs/components/Footer.js +9 -1
- package/lib/commonjs/components/Footer.js.map +1 -1
- package/lib/commonjs/components/HMSKeyboardAvoidingView.js +3 -18
- package/lib/commonjs/components/HMSKeyboardAvoidingView.js.map +1 -1
- package/lib/commonjs/components/HMSLocalScreenshareNotification.js +2 -2
- package/lib/commonjs/components/HMSLocalScreenshareNotification.js.map +1 -1
- package/lib/commonjs/components/HMSManageLeave.js +3 -178
- package/lib/commonjs/components/HMSManageLeave.js.map +1 -1
- package/lib/commonjs/components/HMSNotification.js +4 -3
- package/lib/commonjs/components/HMSNotification.js.map +1 -1
- package/lib/commonjs/components/HMSNotifications.js +32 -6
- package/lib/commonjs/components/HMSNotifications.js.map +1 -1
- package/lib/commonjs/components/HMSOverlayChatView.js +7 -1
- package/lib/commonjs/components/HMSOverlayChatView.js.map +1 -1
- package/lib/commonjs/components/HMSReconnectingNotification.js +33 -0
- package/lib/commonjs/components/HMSReconnectingNotification.js.map +1 -0
- package/lib/commonjs/components/HMSRecordingIndicator.js +1 -1
- package/lib/commonjs/components/HMSRecordingIndicator.js.map +1 -1
- package/lib/commonjs/components/HMSTerminalErrorNotification.js +66 -0
- package/lib/commonjs/components/HMSTerminalErrorNotification.js.map +1 -0
- package/lib/commonjs/components/LeaveRoomBottomSheet.js +175 -0
- package/lib/commonjs/components/LeaveRoomBottomSheet.js.map +1 -0
- package/lib/commonjs/components/Meeting.js +4 -0
- package/lib/commonjs/components/Meeting.js.map +1 -1
- package/lib/commonjs/components/MeetingScreenContent.js +3 -2
- package/lib/commonjs/components/MeetingScreenContent.js.map +1 -1
- package/lib/commonjs/components/PIPView.js +80 -15
- package/lib/commonjs/components/PIPView.js.map +1 -1
- package/lib/commonjs/components/Participants/ParticipantsItemOptions.js +23 -1
- package/lib/commonjs/components/Participants/ParticipantsItemOptions.js.map +1 -1
- package/lib/commonjs/components/PeerVideoTile/AvatarView.js +4 -4
- package/lib/commonjs/components/PeerVideoTile/PeerAudioIndicator.js +3 -1
- package/lib/commonjs/components/PeerVideoTile/PeerAudioIndicator.js.map +1 -1
- package/lib/commonjs/components/PeerVideoTile/PeerVideoTileView.js +1 -1
- package/lib/commonjs/components/PeerVideoTile/PeerVideoTileView.js.map +1 -1
- package/lib/commonjs/components/PreviewForRoleChangeModal.js +2 -2
- package/lib/commonjs/components/PreviewForRoleChangeModal.js.map +1 -1
- package/lib/commonjs/components/RoomSettingsModalContent.js +4 -7
- package/lib/commonjs/components/RoomSettingsModalContent.js.map +1 -1
- package/lib/commonjs/components/StopRecordingModalContent.js +4 -1
- package/lib/commonjs/components/StopRecordingModalContent.js.map +1 -1
- package/lib/commonjs/hooks-util.js +193 -28
- package/lib/commonjs/hooks-util.js.map +1 -1
- package/lib/commonjs/index.js +11 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/redux/actionTypes.js +6 -1
- package/lib/commonjs/redux/actionTypes.js.map +1 -1
- package/lib/commonjs/redux/actions/index.js +22 -1
- package/lib/commonjs/redux/actions/index.js.map +1 -1
- package/lib/commonjs/redux/reducers/appState.js +17 -1
- package/lib/commonjs/redux/reducers/appState.js.map +1 -1
- package/lib/commonjs/redux/reducers/hmsStates.js +15 -4
- package/lib/commonjs/redux/reducers/hmsStates.js.map +1 -1
- package/lib/commonjs/redux/reducers/userState.js +5 -1
- package/lib/commonjs/redux/reducers/userState.js.map +1 -1
- package/lib/commonjs/types.js +10 -1
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/utils/types.js +11 -1
- package/lib/commonjs/utils/types.js.map +1 -1
- package/lib/commonjs/utils.js +1 -7
- package/lib/commonjs/utils.js.map +1 -1
- package/lib/module/HMSPrebuilt.js +16 -14
- package/lib/module/HMSPrebuilt.js.map +1 -1
- package/lib/module/HMSRoomSetup.js +81 -40
- package/lib/module/HMSRoomSetup.js.map +1 -1
- package/lib/module/Icons/Hand/assets/hand-off.png +0 -0
- package/lib/module/Icons/Hand/assets/hand-off@2x.png +0 -0
- package/lib/module/Icons/Hand/assets/hand-off@3x.png +0 -0
- package/lib/module/Icons/Hand/index.js +2 -1
- package/lib/module/Icons/Hand/index.js.map +1 -1
- package/lib/module/Icons/Recording/assets/recording-off.png +0 -0
- package/lib/module/Icons/Recording/assets/recording-off@2x.png +0 -0
- package/lib/module/Icons/Recording/assets/recording-off@3x.png +0 -0
- package/lib/module/Icons/Recording/index.js +2 -1
- package/lib/module/Icons/Recording/index.js.map +1 -1
- package/lib/module/components/DisplayView.js +3 -1
- package/lib/module/components/DisplayView.js.map +1 -1
- package/lib/module/components/EndRoomModal.js +20 -0
- package/lib/module/components/EndRoomModal.js.map +1 -0
- package/lib/module/components/EndRoomModalContent.js +9 -2
- package/lib/module/components/EndRoomModalContent.js.map +1 -1
- package/lib/module/components/Footer.js +9 -1
- package/lib/module/components/Footer.js.map +1 -1
- package/lib/module/components/HMSKeyboardAvoidingView.js +4 -19
- package/lib/module/components/HMSKeyboardAvoidingView.js.map +1 -1
- package/lib/module/components/HMSLocalScreenshareNotification.js +1 -1
- package/lib/module/components/HMSManageLeave.js +5 -181
- package/lib/module/components/HMSManageLeave.js.map +1 -1
- package/lib/module/components/HMSNotification.js +4 -3
- package/lib/module/components/HMSNotification.js.map +1 -1
- package/lib/module/components/HMSNotifications.js +28 -2
- package/lib/module/components/HMSNotifications.js.map +1 -1
- package/lib/module/components/HMSOverlayChatView.js +7 -1
- package/lib/module/components/HMSOverlayChatView.js.map +1 -1
- package/lib/module/components/HMSReconnectingNotification.js +24 -0
- package/lib/module/components/HMSReconnectingNotification.js.map +1 -0
- package/lib/module/components/HMSRecordingIndicator.js +1 -1
- package/lib/module/components/HMSRecordingIndicator.js.map +1 -1
- package/lib/module/components/HMSTerminalErrorNotification.js +57 -0
- package/lib/module/components/HMSTerminalErrorNotification.js.map +1 -0
- package/lib/module/components/LeaveRoomBottomSheet.js +167 -0
- package/lib/module/components/LeaveRoomBottomSheet.js.map +1 -0
- package/lib/module/components/Meeting.js +5 -1
- package/lib/module/components/Meeting.js.map +1 -1
- package/lib/module/components/MeetingScreenContent.js +3 -2
- package/lib/module/components/MeetingScreenContent.js.map +1 -1
- package/lib/module/components/PIPView.js +81 -16
- package/lib/module/components/PIPView.js.map +1 -1
- package/lib/module/components/Participants/ParticipantsItemOptions.js +24 -2
- package/lib/module/components/Participants/ParticipantsItemOptions.js.map +1 -1
- package/lib/module/components/PeerVideoTile/AvatarView.js +4 -4
- package/lib/module/components/PeerVideoTile/PeerAudioIndicator.js +3 -1
- package/lib/module/components/PeerVideoTile/PeerAudioIndicator.js.map +1 -1
- package/lib/module/components/PeerVideoTile/PeerVideoTileView.js +1 -1
- package/lib/module/components/PeerVideoTile/PeerVideoTileView.js.map +1 -1
- package/lib/module/components/PreviewForRoleChangeModal.js +1 -1
- package/lib/module/components/RoomSettingsModalContent.js +6 -9
- package/lib/module/components/RoomSettingsModalContent.js.map +1 -1
- package/lib/module/components/StopRecordingModalContent.js +4 -1
- package/lib/module/components/StopRecordingModalContent.js.map +1 -1
- package/lib/module/hooks-util.js +184 -25
- package/lib/module/hooks-util.js.map +1 -1
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/redux/actionTypes.js +6 -1
- package/lib/module/redux/actionTypes.js.map +1 -1
- package/lib/module/redux/actions/index.js +18 -0
- package/lib/module/redux/actions/index.js.map +1 -1
- package/lib/module/redux/reducers/appState.js +17 -1
- package/lib/module/redux/reducers/appState.js.map +1 -1
- package/lib/module/redux/reducers/hmsStates.js +15 -4
- package/lib/module/redux/reducers/hmsStates.js.map +1 -1
- package/lib/module/redux/reducers/userState.js +5 -1
- package/lib/module/redux/reducers/userState.js.map +1 -1
- package/lib/module/types.js +9 -0
- package/lib/module/types.js.map +1 -1
- package/lib/module/utils/types.js +11 -0
- package/lib/module/utils/types.js.map +1 -1
- package/lib/module/utils.js +0 -6
- package/lib/module/utils.js.map +1 -1
- package/lib/typescript/HMSPrebuilt.d.ts +2 -16
- package/lib/typescript/HMSPrebuilt.d.ts.map +1 -1
- package/lib/typescript/HMSRoomSetup.d.ts.map +1 -1
- package/lib/typescript/Icons/Hand/index.d.ts +1 -0
- package/lib/typescript/Icons/Hand/index.d.ts.map +1 -1
- package/lib/typescript/Icons/Recording/index.d.ts +1 -0
- package/lib/typescript/Icons/Recording/index.d.ts.map +1 -1
- package/lib/typescript/components/DisplayView.d.ts.map +1 -1
- package/lib/typescript/components/EndRoomModal.d.ts +6 -0
- package/lib/typescript/components/EndRoomModal.d.ts.map +1 -0
- package/lib/typescript/components/EndRoomModalContent.d.ts.map +1 -1
- package/lib/typescript/components/Footer.d.ts +1 -0
- package/lib/typescript/components/Footer.d.ts.map +1 -1
- package/lib/typescript/components/HMSKeyboardAvoidingView.d.ts +1 -0
- package/lib/typescript/components/HMSKeyboardAvoidingView.d.ts.map +1 -1
- package/lib/typescript/components/HMSManageLeave.d.ts.map +1 -1
- package/lib/typescript/components/HMSNotification.d.ts +1 -0
- package/lib/typescript/components/HMSNotification.d.ts.map +1 -1
- package/lib/typescript/components/HMSNotifications.d.ts +1 -0
- package/lib/typescript/components/HMSNotifications.d.ts.map +1 -1
- package/lib/typescript/components/HMSOverlayChatView.d.ts.map +1 -1
- package/lib/typescript/components/HMSReconnectingNotification.d.ts +5 -0
- package/lib/typescript/components/HMSReconnectingNotification.d.ts.map +1 -0
- package/lib/typescript/components/HMSTerminalErrorNotification.d.ts +10 -0
- package/lib/typescript/components/HMSTerminalErrorNotification.d.ts.map +1 -0
- package/lib/typescript/components/LeaveRoomBottomSheet.d.ts +6 -0
- package/lib/typescript/components/LeaveRoomBottomSheet.d.ts.map +1 -0
- package/lib/typescript/components/Meeting.d.ts.map +1 -1
- package/lib/typescript/components/PIPView.d.ts.map +1 -1
- package/lib/typescript/components/Participants/ParticipantsItemOptions.d.ts.map +1 -1
- package/lib/typescript/components/PeerVideoTile/PeerAudioIndicator.d.ts.map +1 -1
- package/lib/typescript/components/PeerVideoTile/PeerVideoTileView.d.ts.map +1 -1
- package/lib/typescript/components/RoomSettingsModalContent.d.ts.map +1 -1
- package/lib/typescript/components/StopRecordingModalContent.d.ts.map +1 -1
- package/lib/typescript/hooks-util.d.ts +20 -7
- package/lib/typescript/hooks-util.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +2 -0
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/redux/actionTypes.d.ts +3 -0
- package/lib/typescript/redux/actionTypes.d.ts.map +1 -1
- package/lib/typescript/redux/actions/index.d.ts +23 -14
- package/lib/typescript/redux/actions/index.d.ts.map +1 -1
- package/lib/typescript/redux/index.d.ts +5 -7
- package/lib/typescript/redux/index.d.ts.map +1 -1
- package/lib/typescript/redux/reducers/appState.d.ts +4 -5
- package/lib/typescript/redux/reducers/appState.d.ts.map +1 -1
- package/lib/typescript/redux/reducers/hmsStates.d.ts.map +1 -1
- package/lib/typescript/redux/reducers/index.d.ts +5 -7
- package/lib/typescript/redux/reducers/index.d.ts.map +1 -1
- package/lib/typescript/redux/reducers/userState.d.ts +2 -2
- package/lib/typescript/redux/reducers/userState.d.ts.map +1 -1
- package/lib/typescript/types.d.ts +79 -0
- package/lib/typescript/types.d.ts.map +1 -1
- package/lib/typescript/utils/types.d.ts +24 -0
- package/lib/typescript/utils/types.d.ts.map +1 -1
- package/lib/typescript/utils.d.ts +0 -5
- package/lib/typescript/utils.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/HMSPrebuilt.tsx +32 -23
- package/src/HMSRoomSetup.tsx +105 -53
- package/src/Icons/Hand/assets/hand-off.png +0 -0
- package/src/Icons/Hand/assets/hand-off@2x.png +0 -0
- package/src/Icons/Hand/assets/hand-off@3x.png +0 -0
- package/src/Icons/Hand/index.tsx +13 -3
- package/src/Icons/Recording/assets/recording-off.png +0 -0
- package/src/Icons/Recording/assets/recording-off@2x.png +0 -0
- package/src/Icons/Recording/assets/recording-off@3x.png +0 -0
- package/src/Icons/Recording/index.tsx +9 -2
- package/src/components/DisplayView.tsx +6 -0
- package/src/components/EndRoomModal.tsx +24 -0
- package/src/components/EndRoomModalContent.tsx +9 -2
- package/src/components/Footer.tsx +18 -2
- package/src/components/HMSKeyboardAvoidingView.tsx +5 -23
- package/src/components/HMSLocalScreenshareNotification.tsx +1 -1
- package/src/components/HMSManageLeave.tsx +4 -228
- package/src/components/HMSNotification.tsx +4 -2
- package/src/components/HMSNotifications.tsx +41 -7
- package/src/components/HMSOverlayChatView.tsx +6 -1
- package/src/components/HMSReconnectingNotification.tsx +27 -0
- package/src/components/HMSRecordingIndicator.tsx +1 -1
- package/src/components/HMSTerminalErrorNotification.tsx +70 -0
- package/src/components/LeaveRoomBottomSheet.tsx +199 -0
- package/src/components/Meeting.tsx +7 -0
- package/src/components/MeetingScreenContent.tsx +2 -2
- package/src/components/PIPView.tsx +113 -25
- package/src/components/Participants/ParticipantsItemOptions.tsx +26 -4
- package/src/components/PeerVideoTile/AvatarView.tsx +4 -4
- package/src/components/PeerVideoTile/PeerAudioIndicator.tsx +6 -1
- package/src/components/PeerVideoTile/PeerVideoTileView.tsx +4 -2
- package/src/components/PreviewForRoleChangeModal.tsx +1 -1
- package/src/components/RoomSettingsModalContent.tsx +5 -9
- package/src/components/StopRecordingModalContent.tsx +3 -1
- package/src/hooks-util.ts +243 -25
- package/src/index.ts +2 -0
- package/src/redux/actionTypes.ts +7 -0
- package/src/redux/actions/index.ts +19 -7
- package/src/redux/reducers/appState.ts +18 -1
- package/src/redux/reducers/hmsStates.ts +19 -7
- package/src/redux/reducers/userState.ts +7 -3
- package/src/types.ts +71 -0
- package/src/utils/types.ts +27 -0
- package/src/utils.ts +0 -6
package/lib/module/hooks-util.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { HMSConfig, HMSMessage, HMSMessageRecipientType, HMSPIPListenerActions, HMSPeerUpdate, HMSRoomUpdate, HMSTrackSource, HMSTrackType, HMSTrackUpdate, HMSUpdateListenerActions, HMSMessageRecipient
|
|
1
|
+
import { HMSConfig, HMSMessage, HMSMessageRecipientType, HMSPIPListenerActions, HMSPeerUpdate, HMSRoomUpdate, HMSTrackSource, HMSTrackType, HMSTrackUpdate, HMSUpdateListenerActions, HMSMessageRecipient, useHMSHLSPlayerResolution, useHmsViewsResolutionsState
|
|
2
2
|
// useHMSPeerUpdates,
|
|
3
3
|
} from '@100mslive/react-native-hms';
|
|
4
4
|
import Toast from 'react-native-simple-toast';
|
|
5
5
|
import { useRef, useCallback, useEffect, useState, useMemo, useContext } from 'react';
|
|
6
|
-
import { MaxTilesInOnePage, ModalTypes, PeerListRefreshInterval, PipModes } from './utils/types';
|
|
6
|
+
import { MaxTilesInOnePage, ModalTypes, OnLeaveReason, PeerListRefreshInterval, PipModes } from './utils/types';
|
|
7
7
|
import { createPeerTrackNode } from './utils/functions';
|
|
8
8
|
import { batch, shallowEqual, useDispatch, useSelector, useStore } from 'react-redux';
|
|
9
|
-
import { addMessage, addNotification, addParticipant, addParticipants, addPinnedMessage, addScreenshareTile, addUpdateParticipant, changeMeetingState, changePipModeStatus, changeStartingHLSStream, clearStore, removeNotification, removeParticipant, removeParticipants, removeScreenshareTile, replaceParticipantsList, saveUserData, setActiveChatBottomSheetTab, setActiveSpeakers, setFullScreenPeerTrackNode, setHMSLocalPeerState, setHMSRoleState, setHMSRoomState, setIsLocalAudioMutedState, setIsLocalVideoMutedState, setLayoutConfig, setLocalPeerTrackNode, setMiniViewPeerTrackNode, setModalType, setReconnecting, setRoleChangeRequest, setStartingOrStoppingRecording, updateFullScreenPeerTrackNode, updateLocalPeerTrackNode, updateMiniViewPeerTrackNode, updateScreenshareTile } from './redux/actions';
|
|
9
|
+
import { addMessage, addNotification, addParticipant, addParticipants, addPinnedMessage, addScreenshareTile, addUpdateParticipant, changeMeetingState, changePipModeStatus, changeStartingHLSStream, clearStore, removeNotification, removeParticipant, removeParticipants, removeScreenshareTile, replaceParticipantsList, saveUserData, setActiveChatBottomSheetTab, setActiveSpeakers, setAutoEnterPipMode, setFullScreenPeerTrackNode, setHMSLocalPeerState, setHMSRoleState, setHMSRoomState, setHandleBackButton, setIsLocalAudioMutedState, setIsLocalVideoMutedState, setLayoutConfig, setLocalPeerTrackNode, setMiniViewPeerTrackNode, setModalType, setOnLeaveHandler, setPrebuiltData, setReconnecting, setRoleChangeRequest, setStartingOrStoppingRecording, updateFullScreenPeerTrackNode, updateLocalPeerTrackNode, updateMiniViewPeerTrackNode, updateScreenshareTile } from './redux/actions';
|
|
10
10
|
import { createPeerTrackNodeUniqueId, degradeOrRestorePeerTrackNodes, peerTrackNodeExistForPeer, peerTrackNodeExistForPeerAndTrack, removePeerTrackNodes, removePeerTrackNodesWithTrack, replacePeerTrackNodes, replacePeerTrackNodesWithTrack } from './peerTrackNodeUtils';
|
|
11
11
|
import { MeetingState } from './types';
|
|
12
|
-
import { InteractionManager, Keyboard, Platform } from 'react-native';
|
|
12
|
+
import { BackHandler, InteractionManager, Keyboard, Platform } from 'react-native';
|
|
13
13
|
import { NavigationContext } from '@react-navigation/native';
|
|
14
14
|
import { useIsLandscapeOrientation, useIsPortraitOrientation } from './utils/dimension';
|
|
15
15
|
import { selectChatLayoutConfig, selectConferencingScreenConfig, selectIsHLSViewer, selectLayoutConfigForRole, selectShouldGoLive, selectVideoTileLayoutConfig } from './hooks-util-selectors';
|
|
16
16
|
import { getRoomLayout } from './modules/HMSManager';
|
|
17
17
|
import { DEFAULT_THEME, DEFAULT_TYPOGRAPHY } from './utils/theme';
|
|
18
|
-
import { NotificationTypes } from './
|
|
18
|
+
import { NotificationTypes } from './types';
|
|
19
19
|
export const useHMSListeners = setPeerTrackNodes => {
|
|
20
20
|
const hmsInstance = useHMSInstance();
|
|
21
21
|
const updateLocalPeer = useUpdateHMSLocalPeer(hmsInstance);
|
|
@@ -824,12 +824,21 @@ export const useHMSReconnection = () => {
|
|
|
824
824
|
let mounted = true;
|
|
825
825
|
hmsInstance.addEventListener(HMSUpdateListenerActions.RECONNECTING, () => {
|
|
826
826
|
if (mounted) {
|
|
827
|
-
|
|
827
|
+
batch(() => {
|
|
828
|
+
dispatch(setReconnecting(true));
|
|
829
|
+
dispatch(addNotification({
|
|
830
|
+
id: NotificationTypes.RECONNECTING,
|
|
831
|
+
type: NotificationTypes.RECONNECTING
|
|
832
|
+
}));
|
|
833
|
+
});
|
|
828
834
|
}
|
|
829
835
|
});
|
|
830
836
|
hmsInstance.addEventListener(HMSUpdateListenerActions.RECONNECTED, () => {
|
|
831
837
|
if (mounted) {
|
|
832
|
-
|
|
838
|
+
batch(() => {
|
|
839
|
+
dispatch(setReconnecting(false));
|
|
840
|
+
dispatch(removeNotification(NotificationTypes.RECONNECTING));
|
|
841
|
+
});
|
|
833
842
|
}
|
|
834
843
|
});
|
|
835
844
|
return () => {
|
|
@@ -843,10 +852,10 @@ export const useHMSPIPRoomLeave = () => {
|
|
|
843
852
|
const hmsInstance = useHMSInstance();
|
|
844
853
|
const {
|
|
845
854
|
destroy
|
|
846
|
-
} = useLeaveMethods(
|
|
855
|
+
} = useLeaveMethods();
|
|
847
856
|
useEffect(() => {
|
|
848
857
|
const pipRoomLeaveHandler = () => {
|
|
849
|
-
destroy();
|
|
858
|
+
destroy(OnLeaveReason.PIP);
|
|
850
859
|
};
|
|
851
860
|
hmsInstance.addEventListener(HMSPIPListenerActions.ON_PIP_ROOM_LEAVE, pipRoomLeaveHandler);
|
|
852
861
|
return () => {
|
|
@@ -858,10 +867,10 @@ export const useHMSRemovedFromRoomUpdate = () => {
|
|
|
858
867
|
const hmsInstance = useHMSInstance();
|
|
859
868
|
const {
|
|
860
869
|
destroy
|
|
861
|
-
} = useLeaveMethods(
|
|
870
|
+
} = useLeaveMethods();
|
|
862
871
|
useEffect(() => {
|
|
863
|
-
const removedFromRoomHandler =
|
|
864
|
-
destroy();
|
|
872
|
+
const removedFromRoomHandler = data => {
|
|
873
|
+
destroy(data.roomEnded ? OnLeaveReason.ROOM_END : OnLeaveReason.PEER_KICKED);
|
|
865
874
|
};
|
|
866
875
|
hmsInstance.addEventListener(HMSUpdateListenerActions.ON_REMOVED_FROM_ROOM, removedFromRoomHandler);
|
|
867
876
|
return () => {
|
|
@@ -908,6 +917,71 @@ export const useHMSNetworkQualityUpdate = () => {
|
|
|
908
917
|
return () => hmsInstance.disableNetworkQualityUpdates();
|
|
909
918
|
}, [hmsInstance]);
|
|
910
919
|
};
|
|
920
|
+
export const useEnableAutoPip = () => {
|
|
921
|
+
const hmsInstance = useHMSInstance();
|
|
922
|
+
const enableAutoPip = useCallback(data => {
|
|
923
|
+
hmsInstance.setPipParams({
|
|
924
|
+
...data,
|
|
925
|
+
autoEnterPipMode: true
|
|
926
|
+
});
|
|
927
|
+
}, [hmsInstance]);
|
|
928
|
+
return enableAutoPip;
|
|
929
|
+
};
|
|
930
|
+
export const useDisableAutoPip = () => {
|
|
931
|
+
const hmsInstance = useHMSInstance();
|
|
932
|
+
const disableAutoPip = useCallback(data => {
|
|
933
|
+
hmsInstance.setPipParams({
|
|
934
|
+
...data,
|
|
935
|
+
autoEnterPipMode: false
|
|
936
|
+
});
|
|
937
|
+
}, [hmsInstance]);
|
|
938
|
+
return disableAutoPip;
|
|
939
|
+
};
|
|
940
|
+
export const useAutoPip = oneToOneCall => {
|
|
941
|
+
const enableAutoPip = useEnableAutoPip();
|
|
942
|
+
const disableAutoPip = useDisableAutoPip();
|
|
943
|
+
const autoEnterPipMode = useSelector(state => state.app.autoEnterPipMode);
|
|
944
|
+
const [numerator, denominator] = usePipAspectRatio(oneToOneCall);
|
|
945
|
+
useEffect(() => {
|
|
946
|
+
if (autoEnterPipMode) {
|
|
947
|
+
enableAutoPip({
|
|
948
|
+
aspectRatio: [numerator, denominator]
|
|
949
|
+
});
|
|
950
|
+
return disableAutoPip;
|
|
951
|
+
}
|
|
952
|
+
}, [numerator, denominator, autoEnterPipMode, enableAutoPip, disableAutoPip]);
|
|
953
|
+
};
|
|
954
|
+
export const usePipAspectRatio = oneToOneCall => {
|
|
955
|
+
const isHLSViewer = useIsHLSViewer();
|
|
956
|
+
const hlsPlayerResolution = useHMSHLSPlayerResolution();
|
|
957
|
+
const firstSSNodeId = useSelector(state => {
|
|
958
|
+
var _ssPeerTrackNode$trac;
|
|
959
|
+
const ssPeerTrackNode = state.app.screensharePeerTrackNodes[0];
|
|
960
|
+
return ssPeerTrackNode === null || ssPeerTrackNode === void 0 || (_ssPeerTrackNode$trac = ssPeerTrackNode.track) === null || _ssPeerTrackNode$trac === void 0 ? void 0 : _ssPeerTrackNode$trac.trackId;
|
|
961
|
+
});
|
|
962
|
+
const ssResolution = useHmsViewsResolutionsState(firstSSNodeId);
|
|
963
|
+
const aspectRatio = useMemo(() => {
|
|
964
|
+
// When user is hlsviewer and we have stream resolution
|
|
965
|
+
if (isHLSViewer && hlsPlayerResolution) {
|
|
966
|
+
return [hlsPlayerResolution.width, hlsPlayerResolution.height];
|
|
967
|
+
}
|
|
968
|
+
// When user is hlsviewer and we don't have stream resolution
|
|
969
|
+
if (isHLSViewer) {
|
|
970
|
+
return [9, 16];
|
|
971
|
+
}
|
|
972
|
+
// When we have screenshare resolution, use it
|
|
973
|
+
if (ssResolution) {
|
|
974
|
+
return [ssResolution.width, ssResolution.height];
|
|
975
|
+
}
|
|
976
|
+
// When there is no screenshare and one-to-one call is happening
|
|
977
|
+
if (!firstSSNodeId && oneToOneCall) {
|
|
978
|
+
return [9, 16];
|
|
979
|
+
}
|
|
980
|
+
// default aspect ratio
|
|
981
|
+
return [16, 9];
|
|
982
|
+
}, [isHLSViewer, firstSSNodeId, oneToOneCall, ssResolution, hlsPlayerResolution]);
|
|
983
|
+
return aspectRatio;
|
|
984
|
+
};
|
|
911
985
|
export const useHMSActiveSpeakerUpdates = (setPeerTrackNodes, active) => {
|
|
912
986
|
const hmsInstance = useHMSInstance();
|
|
913
987
|
const dispatch = useDispatch();
|
|
@@ -1255,7 +1329,8 @@ export const useFilteredParticipants = filterText => {
|
|
|
1255
1329
|
const firstTen = filteredList.slice(0, 10);
|
|
1256
1330
|
t.push({
|
|
1257
1331
|
id: role.name,
|
|
1258
|
-
label: `${role.name} (${typeof offStageRoleTotalCount === 'number'
|
|
1332
|
+
label: `${role.name} (${typeof offStageRoleTotalCount === 'number' && offStageRoleTotalCount > filteredList.length ? offStageRoleTotalCount // only use `offStageRoleTotalCount` when it is number and more than list length
|
|
1333
|
+
: filteredList.length})`,
|
|
1259
1334
|
showViewAll: typeof offStageRoleTotalCount === 'number' && formattedSearchText.length <= 0 ? offStageRoleTotalCount > 10 : filteredList.length > 10,
|
|
1260
1335
|
data: firstTen
|
|
1261
1336
|
});
|
|
@@ -1285,12 +1360,12 @@ export const useShouldGoLive = () => {
|
|
|
1285
1360
|
const shouldGoLive = useSelector(selectShouldGoLive);
|
|
1286
1361
|
return shouldGoLive;
|
|
1287
1362
|
};
|
|
1288
|
-
export const useLeaveMethods =
|
|
1363
|
+
export const useLeaveMethods = () => {
|
|
1289
1364
|
const navigation = useContext(NavigationContext);
|
|
1290
1365
|
const hmsInstance = useHMSInstance();
|
|
1291
1366
|
const dispatch = useDispatch();
|
|
1292
1367
|
const reduxStore = useStore();
|
|
1293
|
-
const destroy = useCallback(
|
|
1368
|
+
const destroy = useCallback(reason => {
|
|
1294
1369
|
try {
|
|
1295
1370
|
const s = hmsInstance.destroy();
|
|
1296
1371
|
console.log('Destroy Success: ', s);
|
|
@@ -1316,9 +1391,9 @@ export const useLeaveMethods = isUnmounted => {
|
|
|
1316
1391
|
|
|
1317
1392
|
const onLeave = reduxStore.getState().user.onLeave;
|
|
1318
1393
|
if (typeof onLeave === 'function') {
|
|
1319
|
-
onLeave();
|
|
1394
|
+
onLeave(reason);
|
|
1320
1395
|
dispatch(clearStore());
|
|
1321
|
-
} else if (navigation && navigation.canGoBack
|
|
1396
|
+
} else if (navigation && typeof navigation.canGoBack === 'function' && navigation.canGoBack()) {
|
|
1322
1397
|
navigation.goBack();
|
|
1323
1398
|
dispatch(clearStore());
|
|
1324
1399
|
} else {
|
|
@@ -1332,8 +1407,8 @@ export const useLeaveMethods = isUnmounted => {
|
|
|
1332
1407
|
return Promise.reject(e);
|
|
1333
1408
|
}
|
|
1334
1409
|
}, [hmsInstance]);
|
|
1335
|
-
const leave = useCallback(async function () {
|
|
1336
|
-
let shouldEndStream = arguments.length >
|
|
1410
|
+
const leave = useCallback(async function (reason) {
|
|
1411
|
+
let shouldEndStream = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
1337
1412
|
if (shouldEndStream) {
|
|
1338
1413
|
hmsInstance.stopHLSStreaming().catch(error => {
|
|
1339
1414
|
console.log('Stop HLS Streaming Error: ', error);
|
|
@@ -1342,26 +1417,26 @@ export const useLeaveMethods = isUnmounted => {
|
|
|
1342
1417
|
try {
|
|
1343
1418
|
const d = await hmsInstance.leave();
|
|
1344
1419
|
console.log('Leave Success: ', d);
|
|
1345
|
-
await destroy();
|
|
1420
|
+
await destroy(reason);
|
|
1346
1421
|
} catch (e) {
|
|
1347
1422
|
console.log(`Leave Room Error: ${e}`);
|
|
1348
1423
|
Toast.showWithGravity(`Leave Room Error: ${e}`, Toast.LONG, Toast.TOP);
|
|
1349
1424
|
}
|
|
1350
1425
|
}, [destroy, hmsInstance]);
|
|
1351
|
-
const
|
|
1426
|
+
const prebuiltCleanUp = useCallback(async () => {
|
|
1352
1427
|
try {
|
|
1353
1428
|
await hmsInstance.leave();
|
|
1354
1429
|
await hmsInstance.destroy();
|
|
1355
1430
|
dispatch(clearStore());
|
|
1356
1431
|
} catch (error) {
|
|
1357
|
-
Toast.showWithGravity(`Unable to
|
|
1432
|
+
Toast.showWithGravity(`Unable to leave or destroy: ${error}`, Toast.LONG, Toast.TOP);
|
|
1358
1433
|
}
|
|
1359
1434
|
}, [hmsInstance]);
|
|
1360
|
-
const endRoom = useCallback(async
|
|
1435
|
+
const endRoom = useCallback(async reason => {
|
|
1361
1436
|
try {
|
|
1362
1437
|
const d = await hmsInstance.endRoom('Host ended the room');
|
|
1363
1438
|
console.log('EndRoom Success: ', d);
|
|
1364
|
-
await destroy();
|
|
1439
|
+
await destroy(reason);
|
|
1365
1440
|
} catch (e) {
|
|
1366
1441
|
console.log('EndRoom Error: ', e);
|
|
1367
1442
|
}
|
|
@@ -1370,7 +1445,7 @@ export const useLeaveMethods = isUnmounted => {
|
|
|
1370
1445
|
destroy,
|
|
1371
1446
|
leave,
|
|
1372
1447
|
endRoom,
|
|
1373
|
-
|
|
1448
|
+
prebuiltCleanUp
|
|
1374
1449
|
};
|
|
1375
1450
|
};
|
|
1376
1451
|
|
|
@@ -1508,4 +1583,88 @@ export const useHMSConferencingScreenConfig = (selector, equalityFn) => {
|
|
|
1508
1583
|
return selector(conferencingScreenConfig);
|
|
1509
1584
|
}, equalityFn);
|
|
1510
1585
|
};
|
|
1586
|
+
export const useBackButtonPress = () => {
|
|
1587
|
+
const {
|
|
1588
|
+
handleModalVisibleType
|
|
1589
|
+
} = useModalType();
|
|
1590
|
+
const handleBackPress = useSelector(state => state.app.handleBackButton);
|
|
1591
|
+
useEffect(() => {
|
|
1592
|
+
if (handleBackPress) {
|
|
1593
|
+
const backPressHandler = () => {
|
|
1594
|
+
handleModalVisibleType(ModalTypes.LEAVE_ROOM);
|
|
1595
|
+
|
|
1596
|
+
/**
|
|
1597
|
+
* When true is returned the event will not be bubbled up
|
|
1598
|
+
* & no other back action will execute
|
|
1599
|
+
*/
|
|
1600
|
+
return true;
|
|
1601
|
+
|
|
1602
|
+
/**
|
|
1603
|
+
* Returning false will let the event to bubble up & let other event listeners
|
|
1604
|
+
* or the system's default back action to be executed.
|
|
1605
|
+
*/
|
|
1606
|
+
// return false;
|
|
1607
|
+
};
|
|
1608
|
+
|
|
1609
|
+
const subscription = BackHandler.addEventListener('hardwareBackPress', backPressHandler);
|
|
1610
|
+
return () => {
|
|
1611
|
+
if (typeof subscription.remove === 'function') {
|
|
1612
|
+
subscription.remove();
|
|
1613
|
+
} else {
|
|
1614
|
+
BackHandler.removeEventListener('hardwareBackPress', backPressHandler);
|
|
1615
|
+
}
|
|
1616
|
+
};
|
|
1617
|
+
}
|
|
1618
|
+
}, [handleBackPress, handleModalVisibleType]);
|
|
1619
|
+
};
|
|
1620
|
+
export const useSavePropsToStore = (props, dispatch) => {
|
|
1621
|
+
const {
|
|
1622
|
+
roomCode,
|
|
1623
|
+
options,
|
|
1624
|
+
onLeave,
|
|
1625
|
+
handleBackButton,
|
|
1626
|
+
autoEnterPipMode
|
|
1627
|
+
} = props;
|
|
1628
|
+
useEffect(() => {
|
|
1629
|
+
dispatch(setPrebuiltData({
|
|
1630
|
+
roomCode,
|
|
1631
|
+
options
|
|
1632
|
+
}));
|
|
1633
|
+
}, [roomCode, options]);
|
|
1634
|
+
useEffect(() => {
|
|
1635
|
+
dispatch(setOnLeaveHandler(onLeave));
|
|
1636
|
+
}, [onLeave]);
|
|
1637
|
+
useEffect(() => {
|
|
1638
|
+
if (Platform.OS === 'android') {
|
|
1639
|
+
dispatch(setHandleBackButton(handleBackButton));
|
|
1640
|
+
}
|
|
1641
|
+
}, [handleBackButton]);
|
|
1642
|
+
useEffect(() => {
|
|
1643
|
+
if (Platform.OS === 'android') {
|
|
1644
|
+
dispatch(setAutoEnterPipMode(autoEnterPipMode));
|
|
1645
|
+
}
|
|
1646
|
+
}, [autoEnterPipMode]);
|
|
1647
|
+
};
|
|
1648
|
+
export const useStartRecording = () => {
|
|
1649
|
+
const dispatch = useDispatch();
|
|
1650
|
+
const hmsInstance = useHMSInstance();
|
|
1651
|
+
const startRecording = useCallback(() => {
|
|
1652
|
+
dispatch(setStartingOrStoppingRecording(true));
|
|
1653
|
+
hmsInstance.startRTMPOrRecording({
|
|
1654
|
+
record: true
|
|
1655
|
+
}).catch(error => {
|
|
1656
|
+
batch(() => {
|
|
1657
|
+
dispatch(setStartingOrStoppingRecording(false));
|
|
1658
|
+
dispatch(addNotification({
|
|
1659
|
+
id: Math.random().toString(16).slice(2),
|
|
1660
|
+
type: NotificationTypes.ERROR,
|
|
1661
|
+
message: error.message
|
|
1662
|
+
}));
|
|
1663
|
+
});
|
|
1664
|
+
});
|
|
1665
|
+
}, [hmsInstance]);
|
|
1666
|
+
return {
|
|
1667
|
+
startRecording
|
|
1668
|
+
};
|
|
1669
|
+
};
|
|
1511
1670
|
//# sourceMappingURL=hooks-util.js.map
|