會議室
ArctosLinks.Conference
提供了一套 API 來管理和控制會議室的各種操作。
這些功能包括創建和關閉會議室、處理加入請求、移除參與者、更新會議室資訊、調整屏幕佈局等。
ArctosLinks.ConferenceEventCallback
則提供了一些事件回呼通知,這些通知可以幫助開發者處理會議室中的各種事件。為了觀察這些通知,iOS開發者需要導入 RxSwift,Android開發者需要導入coroutines flow, 該庫未包含在本SDK中,請自行導入。
以下是使用此 SDK 來實現這些操作的方法。
主持人專用
創建會議室 (hostCreateRoom)
功能:創建一個新的會議室。僅限以主持人
身份登錄的用戶操作。
參數:
- roomName: 會議室的標題,類型為字串。
- description: 會議室的詳細描述,類型為字串。
返回值:如果成功創建會議室則完成,否則返回錯誤。
import ArctosLinks
import RxSwift
func hostCreateRoom(roomName: String = "Weekly Meeting", description: String? = "Discuss weekly updates") {
_ = ArctosLinks.Conference.hostCreateRoom(roomName: roomName, description: description)
.subscribe(onSuccess: { _ in
print("🎉 Successfully created conference room.")
}, onFailure: { error in
print("Conference room creation failed: \(error.localizedDescription)")
})
}
import com.arctos.sdk.links.core.application.ArctosLinks
private suspend fun hostCreateRoom(roomName: String = "Weekly Meeting", description: String = "Discuss weekly updates") {
runCatching {
ArctosLinks.getInstance(Context).conferenceManager.hostCreateRoom(roomName = roomName, description = description)
.getOrThrow()
}.onSuccess { result ->
if (result)
Log.d(TAG, "Meeting room created successfully")
else
Log.d(TAG, "Failed to create meeting room")
}.onFailure {
Log.d(TAG, "Failed to create meeting room: ${it.message}")
}
}
#include "arctos_qt.h"
void hostCreateRoom(const std::string& name, const std::string& description) {
auto& arctos_app = arctos::ArctosQt::getInstance();
arctos_app.hostCreateRoom(name.c_str(), description.c_str()); // emit roomCreationFailed signal when failed
}
關閉會議室 (hostCloseRoom)
功能:主持人
關閉會議室。僅限創建該會議室的主持人
操作。
參數:
- roomId: 會議室的ID,類型為字串。
返回值:如果成功關閉會議室則完成,否則返回錯誤。
觸發回呼:會議室主持人關閉會議室
import ArctosLinks
import RxSwift
func hostCloseRoom(roomId: String = "unique_room_id") {
_ = ArctosLinks.Conference.hostCloseRoom(roomId: roomId)
.subscribe(onSuccess: { _ in
print("🎉 Successfully closed room.")
}, onFailure: { error in
print("Failed to close room: \(error.localizedDescription)")
})
}
import com.arctos.sdk.links.core.application.ArctosLinks
private suspend fun hostCloseRoom(roomId: String = "unique_room_id") {
runCatching {
ArctosLinks.getInstance(Context).conferenceManager.hostCloseRoom(roomId = roomId)
.getOrThrow()
}.onSuccess { result ->
if (result)
Log.d(TAG, "Meeting room closed successfully")
else
Log.d(TAG, "Failed to close meeting room")
}.onFailure {
Log.d(TAG, "Failed to close meeting room ${it.message}")
}
}
#include "arctos_qt.h"
void hostCloseRoom(const std::string& room_id) {
auto& arctos_app = arctos::ArctosQt::getInstance();
arctos_app.hostRemoveRoom(room_id.c_str()); // emit roomRemovingFailed signal when failed
}
回應加入請求 (hostJoinHandle)
功能:主持人
回應申請者加入會議室的請求。僅限會議室的主持人
操作。
參數:
- roomId: 會議室的ID,類型為字串。
- applicantId: 申請人的ID,類型為整數。
- accept: 是否同意該申請,類型為布林值。
- message: 同意或拒絕訊息,類型為字串。
返回值:如果成功處理請求則完成,否則返回錯誤。
觸發回呼:加入會議室申請的回覆
import ArctosLinks
import RxSwift
func hostHandleJoinRequest(at roomId: String = "unique_room_id", for applicantId: Int = .min, isAccept: Bool = Bool.random()) {
let message: String = isAccept ? "Welcome!" : "Sorry, all available places have been taken."
_ = ArctosLinks.Conference.hostJoinHandle(roomId: roomId, applicantId: applicantId, accept: isAccept, message: message)
.subscribe(onSuccess: { _ in
if isAccept {
print("Approved applicant to join room.")
} else {
print("Disapproved applicant to join room.")
}
}, onFailure: { error in
print("Failed to handle join request: \(error.localizedDescription)")
})
}
import com.arctos.sdk.links.core.application.ArctosLinks
private suspend fun hostHandleJoinRequest(
roomId: String,
applicantId: String,
accept: Boolean,
message: String? = "Welcome!"
) {
runCatching {
ArctosLinks.getInstance(Context).conferenceManager.hostJoinHandle(
roomId = roomId,
applicantId = applicantId,
accept = accept,
message = message
).getOrThrow()
}.onSuccess { result ->
if (result)
Log.d(TAG, "Approved applicant to join room")
else
Log.d(TAG, "Disapproved applicant to join room")
}.onFailure {
Log.d(TAG, "Failed to handle join request: ${it.message} , ${it.cause}")
}
}
#include "arctos_qt.h"
void hostHandleJoinRequest(const std::string& room_id,
const std::string& user_id,
const std::string& carrier_id,
const std::string& carrier_address,
bool accept) {
auto& arctos_app = arctos::ArctosQt::getInstance();
arctos_app.handleJoinRequest(room_id.c_str(),
user_id.c_str(),
carrier_id.c_str(),
carrier_address.c_str(),
accept); // emit errorMessage when failed
}
移除參與者 (hostKickParticipant)
功能:主持人
移除一位參與者。僅限會議室的主持人
操作。
參數:
- roomId: 會議室的ID,類型為字串。
- participantId: 被移除的參與者的ID,類型為整數。
- message: 說明訊息,類型為字串。
返回值:如果成功移除參與者則完成,否則返回錯誤。
觸發回呼:其他會議參與者收到參與者被會議室主持人移除;被移除的參與者收到會議室主持人移除參與者
import ArctosLinks
import RxSwift
func hostRemoveParticipant(at roomId: String = "unique_room_id", for participantId: Int, with message: String? = "Inappropriate behavior") {
_ = ArctosLinks.Conference.hostKickParticipant(from: roomId, participantId: participantId, with: message)
.subscribe(onSuccess: { _ in
print("Successfully removed participant.")
}, onFailure: { error in
print("Failed to remove participant: \(error.localizedDescription)")
})
}
import com.arctos.sdk.links.core.application.ArctosLinks
private suspend fun hostRemoveParticipant(
roomId: String,
participantId: String,
message: String
) {
runCatching {
ArctosLinks.getInstance(Context).conferenceManager.hostKickParticipant(
roomId = roomId, participantId = participantId, message = message)
.getOrThrow()
}.onSuccess { _ ->
Log.d(TAG, "Successfully removed participant")
}.onFailure {
Log.d(TAG, "Failed to remove participant: ${it.message}")
}
}
#include "arctos_qt.h"
void hostRemoveParticipant(const std::string& room_id,
const std::string& user_id) {
auto& arctos_app = arctos::ArctosQt::getInstance();
arctos_app.leaveRoom(room_id.c_str(), user_id.c_str()); // emit errorMessage when failed
}
更新會議室資訊 (hostUpdateRoomInfo)
功能:主持人
更新會議室的名稱和描述。僅限會議室的主持人
操作。
參數:
- roomId: 會議室的ID,類型為字串。
- roomName: 新的會議室名稱,類型為字串。
- description: 新的會議室描述,類型為字串。
返回值:如果成功更新資訊則完成,否則返回錯誤。
觸發回呼:會議室資訊更新
import ArctosLinks
import RxSwift
func hostUpdateRoomInfo(at roomId: String = "unique_room_id", name: String? = "Updated Room Name", description: String? = "New room description") {
_ = ArctosLinks.Conference.hostUpdateRoomInfo(roomId: roomId, roomName: name, description: description)
.subscribe(onSuccess: { _ in
print("Successfully updated room info.")
}, onFailure: { error in
print("Failed to update room info: \(error.localizedDescription)")
})
}
import com.arctos.sdk.links.core.application.ArctosLinks
private suspend fun hostUpdateRoomInfo(
roomId: String,
roomName: String,
description: String
) {
runCatching {
ArctosLinks.getInstance(Context).conferenceManager.hostUpdateRoomInfo(
roomId = roomId,
roomName = roomName,
description = description
).getOrThrow()
}.onSuccess { _ ->
Log.d(TAG, "Successfully updated room info")
}.onFailure {
Log.d(TAG, "Failed to update room info: ${it.message}")
}
}
#include "arctos_qt.h"
void hostUpdateRoomInfo(const std::string& room_id,
const std::string& name,
const std::string& description) {
auto& arctos_app = arctos::ArctosQt::getInstance();
arctos_app.updateRoomInfo(room_id.c_str(), name.c_str(), description.c_str()); // emit errorMessage when failed
}
切換屏幕佈局 (hostSwitchScreenTemplate)
功能:切換會議室的屏幕佈局。僅限會議室的主持人
操作。
參數:
- templateType (ScreenTemplate): 佈局樣式,可用參數見ScreenTemplate。
錯誤處理:如果用戶未經授權或佈局類型無效,則拋出錯誤。
import ArctosLinks
func hostSwitchTemplate(to template: ArctosLinks.Conference.ScreenTemplate) {
do {
try ArctosLinks.Conference.hostSwitchScreenTemplate(to: .template_1)
print("Successfully switched screen template.")
} catch {
print("Failed to switch screen template: \(error.localizedDescription)")
}
}
import com.arctos.sdk.links.core.application.ArctosLinks
private fun hostSwitchScreenTemplate(template: ConferenceRoomInterface.ScreenTemplate) {
runCatching {
ArctosLinks.getInstance(Context).conferenceManager.hostSwitchScreenTemplate(
template
).getOrThrow()
}.onSuccess {
Log.d(TAG, "Successfully switched screen template")
}.onFailure {
Log.d(TAG, "Failed to switch screen template: ${it.message}")
}
}
#include "arctos_qt.h"
void hostSwitchScreenTemplate(int layout_id /*1 - 4*/) {
auto& arctos_app = arctos::ArctosQt::getInstance();
arctos_app.media()->setTemplate(layout_id);
}
共同
加入會議室 (joinRoom)
功能:發送加入會議室的請求。
參數:
- roomID: 會議室的ID,類型為字串。
會議室創建者即為會議室主持人,發送申請後可立即加入會議室,不需經過審核。
其他申請者需要等待主持人
同意後才能進入會議室。可同時申請多間會議室。
返回值:如果成功遞交申請則完成並返回申請狀態,否則返回錯誤。
觸發回呼:會議室主持人收到申請加入會議室
import ArctosLinks
import RxSwift
func joinRoom(with roomId: String = "unique_room_id") {
_ = ArctosLinks.Conference.joinRoom(roomID: roomId)
.observe(on: MainScheduler.instance)
.subscribe(onSuccess: { status in
switch status {
case .approved:
print("Application approved.")
case .waiting:
print("Application sent. Awaiting review...")
}
}, onFailure: { error in
print(error.localizedDescription)
})
}
import com.arctos.sdk.links.core.application.ArctosLinks
private suspend fun joinRoom(roomId: String) {
runCatching {
ArctosLinks.getInstance(Context).conferenceManager.joinRoom(roomId = roomId)
.getOrThrow()
}.onSuccess { result ->
when (result) {
ArctosLinksCallback.ConferenceEventCallback.JoinRoomResponse.Approve -> {
Log.d(TAG, "Application approved")
}
ArctosLinksCallback.ConferenceEventCallback.JoinRoomResponse.Waiting -> {
Log.d(TAG, "Application sent. Awaiting review...")
}
}
}.onFailure {
Log.d(TAG, "Failed to join room: ${it.message}")
}
}
#include "arctos_qt.h"
void joinRoom(const std::string& room_id) {
auto& arctos_app = arctos::ArctosQt::getInstance();
arctos_app.joinRoom(room_id.c_str());
}
取消加入請求 (cancelJoinRequest)
功能:取消申請加入會議室的請求。
參數:
- roomID: 會議室的ID,類型為字串。
返回值:如果成功取消請求則完成,否則返回錯誤。
觸發回呼:取消加入會議室申請
import ArctosLinks
import RxSwift
func cancelJoin(for roomId: String = "unique_room_id") {
_ = ArctosLinks.Conference.cancelJoinRequest(for: roomId)
.observe(on: MainScheduler.instance)
.subscribe(onSuccess: { _ in
print("Successfully canceled application.")
}, onFailure: { error in
print(error.localizedDescription)
})
}
import com.arctos.sdk.links.core.application.ArctosLinks
private suspend fun cancelJoin(roomId: String) {
runCatching {
ArctosLinks.getInstance(Context).conferenceManager.cancelJoinRequest(roomId = roomId)
.getOrThrow()
}.onSuccess { result ->
if (result)
Log.d(TAG, "cancel success ")
else
Log.d(TAG, "cancel failed ")
}.onFailure {
Log.d(TAG, "cancel failed ")
}
}
#include "arctos_qt.h"
void cancelJoin(const std::string& room_id) {
auto& arctos_app = arctos::ArctosQt::getInstance();
// my_user_id_ is from `loginOk` signal
arctos_app.leaveRoom(room_id.c_str(), my_user_id_);
}
離開會議室 (leaveRoom)
!!! info inline end "注意事項" 如果是主持人
,則同時關閉會議室。 功能:離開會議室。
參數:
- roomID: 會議室的ID,類型為字串。
返回值:如果成功離開會議室則完成,否則返回錯誤。
觸發回呼:參與者離開會議室
import ArctosLinks
import RxSwift
func leaveRoom(_ roomId: String = "unique_room_id") {
_ = ArctosLinks.Conference.leaveRoom(roomId)
.observe(on: MainScheduler.instance)
.subscribe(onSuccess: { _ in
print("Successfully left room.")
}, onFailure: { error in
print(error.localizedDescription)
})
}
import com.arctos.sdk.links.core.application.ArctosLinks
private suspend fun leaveRoom(roomId: String) {
runCatching {
ArctosLinks.getInstance(Context).conferenceManager.leaveRoom(roomId = roomId)
.getOrThrow()
}.onSuccess { result ->
if (result)
Log.d(TAG, "Successfully left room")
else
Log.d(TAG, "Failed to left room")
}.onFailure {
Log.d(TAG, "Failed to left room ${it.message}")
}
}
#include "arctos_qt.h"
void leaveRoom(const std::string& room_id) {
auto& arctos_app = arctos::ArctosQt::getInstance();
// my_user_id_ is from `loginOk` signal
arctos_app.leaveRoom(room_id.c_str(), my_user_id_);
}
獲取會議室列表 (getRoomList)
功能:獲取最新的會議室列表。
返回值:成功時返回會議室列表,否則返回錯誤。
import ArctosLinks
import RxSwift
func retrieveRoomList() {
_ = ArctosLinks.Conference.getRoomList()
.observe(on: MainScheduler.instance)
.subscribe(onSuccess: { data in
dump(data, name: "ArctosLinks.Conference.getRoomList")
}, onFailure: { error in
print(error.localizedDescription)
})
}
import com.arctos.sdk.links.core.application.ArctosLinks
private suspend fun retrieveRoomList() {
runCatching {
ArctosLinks.getInstance(Context).conferenceManager.getRoomList()
.getOrThrow()
}.onSuccess { it ->
val roomList = it.toMutableList()
}.onFailure {
Log.d(TAG, "Failed to retrive Rooms: ${it.message}")
}
}
#include "arctos_qt.h"
void retrieveRoomList() {
auto& arctos_app = arctos::ArctosQt::getInstance();
arctos_app.listRoom(); // emit updateRoomList signal when succeed
}
獲取會議室資訊 (getRoomInfo)
功能:獲取會議室的詳細資訊。
參數:
- roomID: 會議室的ID,類型為字串。
返回: 成功時返回會議室的詳細信息,否則返回錯誤。
import ArctosLinks
import RxSwift
func getInfo(for roomId: String = "unique_room_id") {
_ = ArctosLinks.Conference.getRoomInfo(roomId: roomId)
.subscribe(onSuccess: { roomInfo in
print("Successfully retrieved room info:\(roomInfo)")
}, onFailure: { error in
print("Failed to retrieve room info with error:\(error.localizedDescription)")
})
}
import com.arctos.sdk.links.core.application.ArctosLinks
private suspend fun getRoomInfo() {
runCatching {
ArctosLinks.getInstance(Context).conferenceManager.getRoomInfo(roomId)
.getOrThrow()
}.onSuccess { roomInfo ->
Log.d(TAG, "RoomInfo info: $roomInfo")
}.onFailure {
Log.d(TAG, "onFailure getRoomInfo: ${it.message}")
}
}
#include "arctos_qt.h"
void getRoomInfo(const std::string& room_id) {
auto& arctos_app = arctos::ArctosQt::getInstance();
arctos_app.getRoomInfo(room_id.c_str()); // emit errorMessage signal when failed
}
回呼 (Callback)
申請加入會議室 (requestJoinRoom)
說明:當有使用者請求加入會議室時主持人
會收到此通知。
通知參數:
- id: 申請者的ID,類型為整數。
- name: 申請者的使用者名稱,類型為字串。
import ArctosLinks
import RxSwift
func hostStartObservingJoinEvent() {
_ = ArctosLinks.ConferenceEventCallback.requestJoinRoom
.observe(on: ConcurrentDispatchQueueScheduler(qos: .background))
.subscribe(onNext: { [weak self] (requesterId, requesterName) in
guard let self else { return }
print("\(requesterName)(\(requesterId)) has requested to join.")
})
.disposed(by: disposeBag)
}
import com.arctos.sdk.links.core.application.ArctosLinks
ArctosLinks.getInstance(Context).conferenceManager.conferenceEvent.collect { event ->
when (event) {
is ArctosLinksCallback.ConferenceEventCallback.RequestJoinRoom -> {
Log.d(TAG, "MeetingRoom RequestJoinRoom : ${event.requesterId} , ${event.requesterName}")
}
}
}
#include "arctos_qt.h"
auto& arctos_app = arctos::ArctosQt::getInstance();
QObject::connect(&arctos_app, &ArctosQt::joinedRoom, [](const QString& room_id, const QString& user_id){
LOG(INFO) << "MeetingRoom RequestJoinRoom " << user_id.c_str();
});
取消加入會議室 (cancelJoinRequest)
說明:當申請者取消加入會議的請求時主持人
會收到此通知。
通知參數:
- id: 取消申請者的ID,類型為整數。
import ArctosLinks
import RxSwift
func hostStartObservingCancelEvent() {
_ = ArctosLinks.ConferenceEventCallback.cancelJoinRequest
.subscribe(onNext: { id in
print("\(id) has canceled their request to join.")
})
.disposed(by: disposeBag)
}
import com.arctos.sdk.links.core.application.ArctosLinks
ArctosLinks.getInstance(Context).conferenceManager.conferenceEvent.collect { event ->
when (event) {
is ArctosLinksCallback.ConferenceEventCallback.CancelJoinRoom -> {
Log.d(TAG, "Cancel Join Room ${event.id}")
}
}
}
#include "arctos_qt.h"
auto& arctos_app = arctos::ArctosQt::getInstance();
QObject::connect(&arctos_app, &ArctosQt::joinRequestCancelled, [](const QString& room_id, const QString& user_id){
LOG(INFO) << "MeetingRoom RequestJoinRoomCancelled " << user_id.c_str();
});
申請加入會議室的回覆 (responseJoinRoom)
說明:當主持人
同意或拒絕申請者的加入會議室請求時,申請者會收到此通知。
若主持人
同意則可進入會議室,此時在會議室的其他參與者會收到新參與者加入的通知,若拒絕則不行進入。
通知參數:
- roomId: 會議室的ID,類型為字串。
- isApproved: 同意或拒絕此次申請,類型為布林值。
- message: 訊息,類型為字串。
import ArctosLinks
import RxSwift
func applicantStartObservingJoinResponse() {
_ = ArctosLinks.ConferenceEventCallback.responseJoinRoom
.subscribe(onNext: { (roomID, isApproved, message) in
if isApproved {
print("✅ Application approved in \(roomID), welcome message: \(message ?? "").")
} else {
print("❌ Application disapproved in \(roomID), reason: \(message ?? "").")
}
})
.disposed(by: disposeBag)
}
import com.arctos.sdk.links.core.application.ArctosLinks
ArctosLinks.getInstance(Context).conferenceManager.conferenceEvent.collect { event ->
when (event) {
is ArctosLinksCallback.ConferenceEventCallback.ResponseJoinRoom -> {
Log.d(TAG, "Receive Join Response: ${event.isApprove} , ${event.roomId} , ${event.message}")
}
}
}
#include "arctos_qt.h"
auto& arctos_app = arctos::ArctosQt::getInstance();
QObject::connect(&arctos_app, &ArctosQt::joiningRoomSucceed, [](const QString& room_id, const QString& host_carrier_id){
LOG(INFO) << "Joined room " << room_id.c_str();
});
QObject::connect(&arctos_app, &ArctosQt::joiningRoomFailed, [](const QString& room_id){
LOG(INFO) << "Joined room failed " << room_id.c_str();
});
參與者加入 (participantJoinRoom)
說明:當新的參與者加入會議室時,其他參與者會收到此通知。
通知參數:
- id: 參與者的ID,類型為整數。
import ArctosLinks
import RxSwift
func roomEventObservers() {
_ = ArctosLinks.ConferenceEventCallback.participantJoinRoom
.subscribe(onNext: { id in
print("Participant(\(id)) has joined.")
})
.disposed(by: disposeBag)
}
}
import com.arctos.sdk.links.core.application.ArctosLinks
ArctosLinks.getInstance(Context).conferenceManager.conferenceEvent.collect { event ->
when (event) {
is ArctosLinksCallback.ConferenceEventCallback.ParticipantJoinRoom -> {
Log.d(TAG, "MeetingRoom ParticipantJoinRoom : ${event.participantId}")
}
}
}
#include "arctos_qt.h"
auto& arctos_app = arctos::ArctosQt::getInstance();
QObject::connect(&arctos_app, &ArctosQt::joinedRoom, [](const QString& room_id, const QString& participant_id){
LOG(INFO) << participant_id.c_str() << " joined room " << room_id.c_str();
});
主持人拒絕某位申請者 (applicationRejected)
說明:當主持人
拒絕使用者的申請時,已在會議室的所有參與者都會收到此通知。
通知參數:
- id: 被拒絕的申請者ID,類型為整數。
import ArctosLinks
import RxSwift
func roomEventObservers() {
_ = ArctosLinks.ConferenceEventCallback.applicationRejected
.subscribe(onNext: { id in
print("Applicant(\(id)) has been rejected by the host.")
})
.disposed(by: disposeBag)
}
import com.arctos.sdk.links.core.application.ArctosLinks
ArctosLinks.getInstance(Context).conferenceManager.conferenceEvent.collect { event ->
when (event) {
is ArctosLinksCallback.ConferenceEventCallback.ApplicantRejectByHost -> {
Log.d(TAG, "Applicant Reject By Host : ${event.applicantId}")
}
}
}
#include "arctos_qt.h"
auto& arctos_app = arctos::ArctosQt::getInstance();
QObject::connect(&arctos_app, &ArctosQt::userRemoved, [](const QString& room_id, const QString& user_id){
LOG(INFO) << user_id.c_str() << " rejected";
});
參與者離開會議室 (participantLeftRoom)
說明:當參與者離開會議室時,在會議室的所有參與者都會收到此通知。
通知參數:
- id: 參與者的ID,類型為整數。
- message: 離開原因,類型為字串。
import ArctosLinks
import RxSwift
func roomEventObservers() {
_ = ArctosLinks.ConferenceEventCallback.participantLeftRoom
.subscribe(onNext: { (id, message) in
print("Participant(\(id)) has left the room due to \(message ?? "unknown reasons").")
})
.disposed(by: disposeBag)
}
import com.arctos.sdk.links.core.application.ArctosLinks
ArctosLinks.getInstance(Context).conferenceManager.conferenceEvent.collect { event ->
when (event) {
is ArctosLinksCallback.ConferenceEventCallback.ParticipantLeftRoom -> {
Log.d(TAG, "MeetingRoom Participant Left Room : ${event.participantId}, ${event.message}")
}
}
}
#include "arctos_qt.h"
auto& arctos_app = arctos::ArctosQt::getInstance();
QObject::connect(&arctos_app, &ArctosQt::userRemoved, [](const QString& room_id, const QString& user_id){
LOG(INFO) << user_id.c_str() << " removed";
});
會議室主持人移除參與者 (kickOutByHost)
!!! info inline end "注意事項" 只有被移除的參與者會收到此通知。 說明:當參與者被主持人移出會議室時,會收到此通知。
通知參數:
- message: 主持人移除參與者的原因,類型為字串。
import ArctosLinks
import RxSwift
func roomEventObservers() {
_ = ArctosLinks.ConferenceEventCallback.kickOutByHost
.subscribe(onNext: { message in
print("Removed by the host due to \(message ?? "unknown reasons").")
})
.disposed(by: disposeBag)
}
import com.arctos.sdk.links.core.application.ArctosLinks
ArctosLinks.getInstance(Context).conferenceManager.conferenceEvent.collect { event ->
when (event) {
is ArctosLinksCallback.ConferenceEventCallback.ParticipantKickedOutByHost -> {
Log.d(TAG, "我被主持人踢出 ${event.message}")
}
}
}
#include "arctos_qt.h"
auto& arctos_app = arctos::ArctosQt::getInstance();
QObject::connect(&arctos_app, &ArctosQt::userRemoved, [](const QString& room_id, const QString& user_id){
LOG(INFO) << user_id.c_str() << " kicked";
});
參與者被會議室主持人移除 (participantKickedOutRoom)
!!! info inline end "注意事項" 會議室的所有參與者皆會收到此通知。 說明:當參與者被主持人移出會議室時,會收到此通知。
通知參數:
- id: 被移除的參與者ID,類型為整數。
import ArctosLinks
import RxSwift
func roomEventObservers() {
_ = ArctosLinks.ConferenceEventCallback.participantKickedOutRoom
.subscribe(onNext: { id in
print("Participant(\(id)) has been removed from the room.")
})
.disposed(by: disposeBag)
}
import com.arctos.sdk.links.core.application.ArctosLinks
ArctosLinks.getInstance(Context).conferenceManager.conferenceEvent.collect { event ->
when (event) {
is ArctosLinksCallback.ConferenceEventCallback.ParticipantKickedOutRoom -> {
Log.d(TAG,"$Participant {event.participantId} has been removed from the room.")
}
}
}
#include "arctos_qt.h"
auto& arctos_app = arctos::ArctosQt::getInstance();
QObject::connect(&arctos_app, &ArctosQt::userRemoved, [](const QString& room_id, const QString& user_id){
LOG(INFO) << user_id.c_str() << " kicked";
});
會議室主持人關閉會議室 (hostCloseRoom)
!!! info inline end "注意事項" 會議室的所有參與者皆會收到此通知。 說明:當主持人
關閉會議室或離開會議室時,會收到此通知。
通知參數:
- message: 主持人關閉會議室的原因,類型為字串。
import ArctosLinks
import RxSwift
func roomEventObservers() {
_ = ArctosLinks.ConferenceEventCallback.hostCloseRoom
.subscribe(onNext: { message in
print("The host closed the room due to \(message ?? "unknown reasons").")
})
.disposed(by: disposeBag)
}
import com.arctos.sdk.links.core.application.ArctosLinks
ArctosLinks.getInstance(Context).conferenceManager.conferenceEvent.collect { event ->
when (event) {
is ArctosLinksCallback.ConferenceEventCallback.HostCloseRoom -> {
Log.d(TAG, "MeetingRoom closed : ${event.message}")
}
}
}
#include "arctos_qt.h"
auto& arctos_app = arctos::ArctosQt::getInstance();
QObject::connect(&arctos_app, &ArctosQt::roomRemoved, [](const QString& room_id){
LOG(INFO) << room_id.c_str() << " removed";
});
會議室資訊更新 (roomInfoUpdated)
說明:當會議室資訊被更新時,會議室中所有人會收到此通知。
通知參數:
- roomName: 新的房間名稱,類型為字串。
- description: 新的房間描述,類型為字串。
import ArctosLinks
import RxSwift
func roomEventObservers() {
_ = ArctosLinks.ConferenceEventCallback.roomInfoUpdated
.subscribe(onNext: { (roomName, description) in
var body: String = ""
if let roomName {
body.append(" roomName: \(roomName)")
}
if let description {
body.append(" description: \(description)")
}
print("Room info has been updated. New info:\(body)")
})
.disposed(by: disposeBag)
}
import com.arctos.sdk.links.core.application.ArctosLinks
ArctosLinks.getInstance(Context).conferenceManager.conferenceEvent.collect { event ->
when (event) {
is ArctosLinksCallback.ConferenceEventCallback.RoomInfoUpdate -> {
Log.d(TAG, "MeetingRoom update : ${event.roomName}, ${event.description}")
}
}
}
#include "arctos_qt.h"
auto& arctos_app = arctos::ArctosQt::getInstance();
QObject::connect(&arctos_app, &ArctosQt::roomInfoUpdated, [](const QString& name, const QString& description){
LOG(INFO) << "new name " name.c_str() << "; new description " << description.c_str();
});
參與者在線狀態改變 (updateParticipant)
說明:當會議室中參與者的在線狀態變更時,會議室中的所有人都會收到此通知。
通知參數:
- id: 參與者的ID,類型為整數。
- name: 參與者的使用者名稱,類型為字串。
- isOnline: 參與者的在線狀態,類型為布林值。
import ArctosLinks
import RxSwift
func hostStartObservingMemberOnlineStatus() {
_ = ArctosLinks.ConferenceEventCallback.updateParticipant
.observe(on: ConcurrentDispatchQueueScheduler(qos: .background))
.subscribe(onNext: { (id, name, isOnline) in
print("\(name)(\(id)) is currently \(isOnline ? "online" : "offline").")
})
.disposed(by: disposeBag)
}
import com.arctos.sdk.links.core.application.ArctosLinks
ArctosLinks.getInstance(Context).conferenceManager.conferenceEvent.collect { event ->
when (event) {
is ArctosLinksCallback.ConferenceEventCallback.UpdateParticipant -> {
Log.d(TAG, "MeetingRoom Update Participant : ${event.id} , ${event.name} , ${event.isOnline}")
}
}
}
#include "arctos_qt.h"
auto& arctos_app = arctos::ArctosQt::getInstance();
QObject::connect(&arctos_app, &ArctosQt::updateFriendList, [](const QVariant& updated_friend_list){
for (const auto& user : friend_list) {
const auto friend_map = user.toMap();
if (friend_map["status"].toString() == "Offline") {
LOG(INFO) << "Offline";
} else {
LOG(INFO) << "Online";
}
}
});
類型
枚舉類別
JoinRoomResponse
功能:用於申請加入會議室時,會收到的申請狀態。
成員:
- approved: 審核通過,加入會議室,只有在使用者同時為創建會議室的
主持人
時才會收到。 - waiting: 等待會議室
主持人
審核中。
/// Represents the possible outcomes of a join room request.
///
/// This enumeration is typically used as the result type when a user attempts to join a conference room.
/// It allows for clear differentiation between an immediate approval and a pending state.
enum JoinRoomResponse {
/// Indicates that the join room request was immediately approved.
/// The user can proceed to enter the conference room.
case approved
/// Indicates that the join room request is pending approval.
/// The user must wait for the host to make a decision on their request.
case waiting
}
sealed class JoinRoomResponse {
data object Approve : JoinRoomResponse()
data object Waiting : JoinRoomResponse()
}
// no enum, used different signals to distinguish events
// joiningRoomFailed
// joiningRoomSucceed
ScreenTemplate
功能:用於列舉會議室可用的顯示布局。
成員:
- template_1: 左上方一個小框,其餘部分填滿。
- template_2: 左右兩個相同大小的框。
- template_3: 上方三個框,下方一個框填滿。
- template_4: 四個相等大小的框。
屬性:
- representValue: 返回每個模板的字符串表示形式,類型為字串。
/// Enumerates the available display layouts for the conference room.
enum ScreenTemplate: CaseIterable {
/// One small frame on the left top, one frame filling the rest
case template_1
/// Two equal frames side by side
case template_2
/// Three frames on top, one frame filling the bottom
case template_3
/// Four equally distributed frames
case template_4
/// The string representation of each template.
public var representValue: String {
switch self {
case .template_1:
return "template No.1"
case .template_2:
return "template No.2"
case .template_3:
return "template No.3"
case .template_4:
return "template No.4"
}
}
}
sealed class ScreenTemplate {
data object Template1 : ScreenTemplate()
data object Template2 : ScreenTemplate()
data object Template3 : ScreenTemplate()
data object Template4 : ScreenTemplate()
}
// integer 1, 2, 3, 4
結構體
RoomList
功能:用於表示會議室列表中的會議室資訊。
屬性:
- roomID: 會議室的唯一識別碼,類型為字串。
- name: 會議室的顯示名稱,類型為字串。
- description: 會議室的詳細描述,類型為可選字串。
- host: 主持人資訊,類型為結構體,屬性見RoomInfo.Host。
RoomInfo
功能:用於表示特定會議室的詳細資訊。
屬性:
- roomID: 會議室的ID,類型為字串。
- name: 會議室的顯示名稱,類型為字串。
- description: 會議室的詳細描述,類型為字串。
- host: 主持人的資訊,類型為結構體,屬性見RoomInfo.Host。
- participants: 參與者的資訊列表,類型為結構體,屬性見RoomInfo.Participant。
- applicants: 申請者的資訊列表(僅主持人可見),類型為結構體,屬性見RoomInfo.Applicant。
Host
功能:用於表示會議室主持人的資訊。
屬性:
- id: 主持人的ID,類型為整數。
- displayName: 主持人的顯示名稱,類型為字串。
Participant
功能:用於表示會議室參與者的資訊。
屬性:
- id: 參與者的ID,類型為整數。
- displayName: 參與者的顯示名稱,類型為字串。
Applicant
功能:用於表示申請加入會議室的成員資訊。
屬性:
- id: 申請者的ID,類型為整數。
- displayName: 申請者的顯示名稱,類型為字串。