fixing daily api and domain

This commit is contained in:
Jeff Emmett 2024-12-08 19:19:19 -05:00
parent cc216eb07f
commit 9ff366c80b
1 changed files with 15 additions and 6 deletions

View File

@ -86,8 +86,8 @@ export class VideoChatShape extends BaseBoxShapeUtil<IVideoChatShape> {
} }
try { try {
// Create room directly with Daily.co API // Create room using the worker endpoint
const response = await fetch("https://api.daily.co/v1/rooms", { const response = await fetch(`${WORKER_URL}/daily/rooms`, {
method: "POST", method: "POST",
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
@ -97,17 +97,26 @@ export class VideoChatShape extends BaseBoxShapeUtil<IVideoChatShape> {
name: `canvas-room-${shape.id}`, name: `canvas-room-${shape.id}`,
privacy: "public", privacy: "public",
properties: { properties: {
enable_recording: true, enable_chat: true,
start_audio_off: true, start_audio_off: true,
start_video_off: true, start_video_off: true,
enable_chat: true, enable_screenshare: true,
enable_recording: "cloud",
max_participants: 8, max_participants: 8,
enable_network_ui: true,
enable_prejoin_ui: true,
enable_people_ui: true,
enable_pip_ui: true,
enable_emoji_reactions: true,
enable_hand_raising: true,
enable_noise_cancellation_ui: true,
}, },
}), }),
}) })
if (!response.ok) { if (!response.ok) {
throw new Error(`Failed to create room: ${response.statusText}`) const error = await response.json()
throw new Error(`Failed to create room: ${JSON.stringify(error)}`)
} }
const data = await response.json() const data = await response.json()
@ -119,7 +128,7 @@ export class VideoChatShape extends BaseBoxShapeUtil<IVideoChatShape> {
type: "VideoChat", type: "VideoChat",
props: { props: {
...shape.props, ...shape.props,
roomUrl, roomUrl: roomUrl,
}, },
}) })
} catch (error) { } catch (error) {