Skip to content

Commit

Permalink
frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
LunarFang416 committed Mar 22, 2024
1 parent 7450113 commit 4de16aa
Showing 1 changed file with 33 additions and 53 deletions.
86 changes: 33 additions & 53 deletions picea/frontend/src/components/MeetingRoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
})
};


Expand Down

0 comments on commit 4de16aa

Please sign in to comment.