// iOS
let params = RoomParams()
SendBirdCall.createRoom(with: params) { room, error in
guard let room = room, error == nil else { return } // Handle error
let params = RoomEnterParams()
room.enter(with: params) { room, error in
guard let room = room, error == nil else { return } // Handle error
// user has successfully joined `room`
}
}
// Android
SendBirdCall.createRoom(params, object : RoomHandler {
override fun onResult(room: Room?, e: SendBirdException?) {
if (room == null || e != null) {
// handle error
return
}
// `room` is created with a unique identifier `room.roomId`
room.enter(params, object : CompletionHandler {
override fun onResult(e: SendBirdException?) {
if (e != null) {
// handle error
}
}
}
})
// JavaScript
const roomOptions = {
roomType: 'small_room_for_video'
};
SendBirdCall.createRoom(roomOptions)
.then(room => {
// Create room succeeded
const enterParams = {
videoEnabled: true,
audioEnabled: true
}
room.enter(params)
.then(() => {
// User has successfully entered `room`.
})
.catch(e => {
// Handle error
});
}).catch(e => {
// Create room failed
});
try {
const room = await SendbirdCalls.createRoom({
roomType: SendbirdCalls.RoomType.SMALL_ROOM_FOR_VIDEO,
});
// Create room succeeded
await room.enter({
videoEnabled: true,
audioEnabled: true,
});
// User has successfully entered
} catch (e) {
// Handle error
}
SbRoomParams roomParams = new SbRoomParams();
SendbirdCall.CreateRoom(roomParams, (room, createRoomError) =>
{
if (createRoomError == null)
{
// Create room succeeded
SbRoomEnterParams roomEnterParams = new SbRoomEnterParams()
{
AudioEnabled = true,
};
room.Enter(roomEnterParams, (enterRoomError) =>
{
if (enterRoomError == null)
{
// User has successfully entered
}
});
}
else
{
// Handle error
}
});