Skip to content

Commit

Permalink
Enable AntMedia unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mustafaboleken committed Dec 17, 2024
1 parent cad8e4d commit cf6d4a5
Show file tree
Hide file tree
Showing 2 changed files with 140 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1752,7 +1752,6 @@ describe('AntMedia Component', () => {
jest.useFakeTimers();
currentConference.fakeReconnect();
expect(webRTCAdaptorConstructor.iceConnectionState()).toBe("disconnected");
expect(webRTCAdaptorScreenConstructor.iceConnectionState()).toBe("disconnected");
jest.runAllTimers();
});

Expand Down
140 changes: 140 additions & 0 deletions react/src/pages/AntMedia.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import PublisherRequestListDrawer from "../Components/PublisherRequestListDrawer
import {WebinarRoles} from "../WebinarRoles";
import Stack from "@mui/material/Stack";

export const ConferenceContext = React.createContext(null);

const globals = {
//this settings is to keep consistent with the sdk until backend for the app is setup
Expand Down Expand Up @@ -3009,6 +3010,10 @@ function AntMedia(props) {
}
window.makeFullScreen = makeFullScreen;

function setMicAudioLevel(audioLevel) {
webRTCAdaptor?.setVolumeLevel(audioLevel);
}

const handleMuteParticipant = React.useCallback((participant) => {
setParticipantIdMuted(participant);

Check warning on line 3018 in react/src/pages/AntMedia.js

View check run for this annotation

Codecov / codecov/patch

react/src/pages/AntMedia.js#L3018

Added line #L3018 was not covered by tests
}, []);
Expand Down Expand Up @@ -3055,6 +3060,140 @@ function AntMedia(props) {
justifyContent="center"
alignItems={"center"}
>
<ConferenceContext.Provider
value={{
isScreenShared,
talkers,
audioTracks,
isPublished,
selectedCamera,
selectedMicrophone,
selectedBackgroundMode,
videoTrackAssignments,
setVideoTrackAssignments,
messageDrawerOpen,
participantListDrawerOpen,
messages,
numberOfUnReadMessages,
participantUpdated,
allParticipants,
globals,
isPlayOnly,
setIsPlayOnly,
localVideo,
streamName,
initialized,
devices,
publishStreamId,
isMyMicMuted,
isMyCamTurnedOff,
sendReactions,
setSelectedBackgroundMode,
setIsVideoEffectRunning,
handleMessageDrawerOpen,
handleParticipantListOpen,
setSelectedCamera,
setSelectedMicrophone,
setLeftTheRoom,
joinRoom,
handleStopScreenShare,
handleStartScreenShare,
cameraSelected,
microphoneSelected,
handleBackgroundReplacement,
muteLocalMic,
unmuteLocalMic,
checkAndTurnOnLocalCamera,
checkAndTurnOffLocalCamera,
setAudioLevelListener,
handleSetMessages,
toggleSetNumberOfUnreadMessages,
pinVideo,
setLocalVideo,
setWaitingOrMeetingRoom,
setStreamName,
handleLeaveFromRoom,
handleSendNotificationEvent,
handleSetDesiredTileCount,
handleSendMessage,
turnOffYourMicNotification,
addFakeParticipant,
removeFakeParticipant,
fakeReconnect,
showEmojis,
setShowEmojis,
isMuteParticipantDialogOpen,
setMuteParticipantDialogOpen,
participantIdMuted,
setParticipantIdMuted,
videoSendResolution,
setVideoSendResolution,
makeid,
startRecord,
stopRecord,
isRecordPluginInstalled,
isRecordPluginActive,
isEnterDirectly,
publisherRequestListDrawerOpen,
setPublisherRequestListDrawerOpen,
isAdmin,
setIsAdmin,
presenterButtonDisabled,
setPresenterButtonDisabled,
effectsDrawerOpen,
handleEffectsOpen,
setVirtualBackgroundImage,
localVideoCreate,
microphoneButtonDisabled,
setMicrophoneButtonDisabled,
cameraButtonDisabled,
setCameraButtonDisabled,
updateMaxVideoTrackCount,
checkAndUpdateVideoAudioSources,
setDevices,
getSelectedDevices,
setIsJoining,
isJoining,
setParticipantUpdated,
makeParticipantPresenter,
makeParticipantUndoPresenter,
isBecomePublisherConfirmationDialogOpen,
setBecomePublisherConfirmationDialogOpen,
requestSpeakerList,
turnOnYourMicNotification,
turnOffYourCamNotification,
handlePublisherRequestListOpen,
setRequestSpeakerList,
presenterButtonStreamIdInProcess,
roomName,
role,
speedTestObject,
setSpeedTestObject,
speedTestStreamId,
startSpeedTest,
stopSpeedTest,
statsList,
getTrackStats,
isBroadcasting,
playStats,
checkAndSetIsPinned,
setMicAudioLevel,
updateAllParticipantsPagination,
pagedParticipants,
participantCount,
setParticipantCount,
checkAndUpdateVideoAudioSourcesForPublishSpeedTest,
fetchImageAsBlob,
setAndEnableVirtualBackgroundImage,
setAndFillPlayStatsList,
setAndFillPublishStatsList,
setSpeedTestObjectFailed,
setSpeedTestObjectProgress,
calculateThePlaySpeedTestResult,
processUpdatedStatsForPlaySpeedTest,
speedTestCounter
}}
>
{props.children}
<UnauthrorizedDialog
onClose={handleUnauthorizedDialogExitClicked}
Expand Down Expand Up @@ -3279,6 +3418,7 @@ function AntMedia(props) {
<PublisherRequestListDrawer/>
</>
)}
</ConferenceContext.Provider>
</Grid>
</Grid>
);
Expand Down

0 comments on commit cf6d4a5

Please sign in to comment.