From 4de16aacc82023075932e573db830a94cb05124b Mon Sep 17 00:00:00 2001 From: LunarFang416 Date: Fri, 22 Mar 2024 14:51:13 -0400 Subject: [PATCH] frontend --- picea/frontend/src/components/MeetingRoom.js | 86 ++++++++------------ 1 file changed, 33 insertions(+), 53 deletions(-) diff --git a/picea/frontend/src/components/MeetingRoom.js b/picea/frontend/src/components/MeetingRoom.js index f5566bf..84934aa 100644 --- a/picea/frontend/src/components/MeetingRoom.js +++ b/picea/frontend/src/components/MeetingRoom.js @@ -3,6 +3,7 @@ import { useParams } from 'react-router-dom'; import { FeaturedRemoteVideos, useMeetingManager, VideoTileGrid, useLocalVideo, DeviceLabels, LocalVideo, PreviewVideo } from 'amazon-chime-sdk-component-library-react'; import { MeetingSessionConfiguration } from 'amazon-chime-sdk-js'; import Button from './Button' +import axios from 'axios'; function uuid() { return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { @@ -48,60 +49,39 @@ const MeetingRoom = () => { useEffect(() => { const joinMeeting = async () => { - const testMeeting = { - ExternalMeetingId: 'default-meeting', - MediaPlacement: { - AudioFallbackUrl: 'wss://haxrp.m3.ue1.app.chime.aws:443/calls/d08b4401-68ec-4449-8225-003767292713', - AudioHostUrl: 'c9290c8cf39f9e5f401e9d685cd79e17.k.m3.ue1.app.chime.aws:3478', - EventIngestionUrl: 'https://data.svc.ue1.ingest.chime.aws/v1/client-events', - ScreenDataUrl: 'wss://bitpw.m3.ue1.app.chime.aws:443/v2/screen/d08b4401-68ec-4449-8225-003767292713', - ScreenSharingUrl: 'wss://bitpw.m3.ue1.app.chime.aws:443/v2/screen/d08b4401-68ec-4449-8225-003767292713', - ScreenViewingUrl: 'wss://bitpw.m3.ue1.app.chime.aws:443/ws/connect?passcode=null&viewer_uuid=null&X-BitHub-Call-Id=d08b4401-68ec-4449-8225-003767292713', - SignalingUrl: 'wss://signal.m3.ue1.app.chime.aws/control/d08b4401-68ec-4449-8225-003767292713', - TurnControlUrl: 'https://2713.cell.us-east-1.meetings.chime.aws/v2/turn_sessions' - }, - MediaRegion: 'us-east-1', - MeetingArn: 'arn:aws:chime:us-east-1:351964880991:meeting/d08b4401-68ec-4449-8225-003767292713', - MeetingId: 'd08b4401-68ec-4449-8225-003767292713', - TenantIds: [] - } - - const attendee = { - AttendeeId: 'b8e4dcbe-867f-f444-7e5f-b7b985e0aa94', - Capabilities: { - Audio: 'SendReceive', - Content: 'SendReceive', - Video: 'SendReceive' - }, - ExternalUserId: 'default-user', - JoinToken: 'YjhlNGRjYmUtODY3Zi1mNDQ0LTdlNWYtYjdiOTg1ZTBhYTk0OmEyNDBmOTU3LTFkZTEtNDk5ZS04Nzg5LTFhODdmM2JiOTRkOQ' - } - - const meetingSessionConfiguration = new MeetingSessionConfiguration(testMeeting, attendee); - const options = { - deviceLabels: DeviceLabels.AudioAndVideo, - }; - console.log(meetingSessionConfiguration); - - // Use the join API to create a meeting session using DeviceLabels.Video - await meetingManager.join( - meetingSessionConfiguration, - options - ); - console.log(meetingManager.meetingSession) - // At this point you can let users setup their camera device - // Or by default the SDK selects the first device in the list for the kind indicated by `deviceLabels` - - await meetingManager.start(); - console.log(meetingManager.meetingSession) - - await meetingManager.meetingSession?.audioVideo?.startVideoInput( - meetingManager.selectedVideoInputDevice + axios( + "https://bkd4zey0l4.execute-api.us-east-1.amazonaws.com/dev/meeting" + ).then(async (response) => { + console.log(response) + const testMeeting = response.data.meeting; + const attendee = response.data.attendee; + + const meetingSessionConfiguration = new MeetingSessionConfiguration(testMeeting, attendee); + const options = { + deviceLabels: DeviceLabels.AudioAndVideo, + }; + console.log(meetingSessionConfiguration); + + // Use the join API to create a meeting session using DeviceLabels.Video + await meetingManager.join( + meetingSessionConfiguration, + options ); - meetingManager.meetingSession?.audioVideo?.startLocalVideoTile(); - // setIsVideoEnabled(true); - // await toggleVideo(); - setMeetingJoined(true); + console.log(meetingManager.meetingSession) + // At this point you can let users setup their camera device + // Or by default the SDK selects the first device in the list for the kind indicated by `deviceLabels` + + await meetingManager.start(); + console.log(meetingManager.meetingSession) + + await meetingManager.meetingSession?.audioVideo?.startVideoInput( + meetingManager.selectedVideoInputDevice + ); + meetingManager.meetingSession?.audioVideo?.startLocalVideoTile(); + // setIsVideoEnabled(true); + // await toggleVideo(); + setMeetingJoined(true); + }) };