This function sends a POST request to the MediaSFU API to create a new room.
It validates the provided credentials and constructs the appropriate API endpoint,
including support for the Community Edition via a custom localLink.
Param: options
Configuration options for creating the room.
Param: options.payload
The payload containing the room creation details.
Param: options.apiUserName
The API username, used for authentication.
Param: options.apiKey
The API key, used for authentication.
Param: options.localLink
The local link for Community Edition users. If provided, it overrides the default API URL.
Returns
A promise resolving to an object containing the API response:
data: The response object, either CreateJoinRoomResponse or CreateJoinRoomError.
success: Boolean indicating whether the operation was successful.
Throws
Throws an error if the request fails or if the provided credentials are invalid.
Example
constresponse = awaitcreateRoomOnMediaSFU({ payload: { action:'create', duration:60, // Duration in minutes capacity:10, // Max participants userName:'hostUser', scheduledDate:Date.now() + 3600000, // One hour from now secureCode:'secure123', // Optional eventType:'conference', // Optional }, apiUserName:'yourAPIUSERNAME', apiKey:'yourAPIKEY', localLink:'http://localhost:3000', // Optional for Community Edition });
if (response.success) { console.log('Room created successfully:', response.data); } else { console.error('Failed to create room:', response.data?.error); }
Asynchronously creates a room on MediaSFU.
This function sends a POST request to the MediaSFU API to create a new room. It validates the provided credentials and constructs the appropriate API endpoint, including support for the Community Edition via a custom
localLink.Param: options
Configuration options for creating the room.
Param: options.payload
The payload containing the room creation details.
Param: options.apiUserName
The API username, used for authentication.
Param: options.apiKey
The API key, used for authentication.
Param: options.localLink
The local link for Community Edition users. If provided, it overrides the default API URL.
Returns
A promise resolving to an object containing the API response:
data: The response object, eitherCreateJoinRoomResponseorCreateJoinRoomError.success: Boolean indicating whether the operation was successful.Throws
Throws an error if the request fails or if the provided credentials are invalid.
Example