opentalk_roomserver_module_livekit/loopback/
create_room.rs1use std::sync::Arc;
6
7use livekit_api::services::room::{CreateRoomOptions, RoomClient};
8use opentalk_roomserver_types_livekit::LiveKitError;
9
10use crate::loopback::LiveKitLoopback;
11
12pub async fn create_room(
13 livekit_client: Arc<RoomClient>,
14 subroom_id: String,
15) -> Result<LiveKitLoopback, LiveKitError> {
16 let room = livekit_client
17 .create_room(&subroom_id, CreateRoomOptions::default())
18 .await
19 .map_err(|err| {
20 tracing::error!(error = ?err, "failed to create room");
21 LiveKitError::LivekitUnavailable
22 })?;
23 tracing::debug!("LiveKit room created: {}", room.name);
24 Ok(LiveKitLoopback::RoomCreated)
25}