Single-person co-mic | Multi-person co-mic |
| |
Click the co-mic request button | Choose the way to connect the microphone | Send a connection request and wait for the host to agree | After the host agrees, the connection is successful |
| | | |
Received the audience's connection request | Click on the connected mic user to open the connection dashboard | After clicking agree, the connection is successful |
| | |
// File Location:TUILiveKit/Source/View/LiveRoom/
View/Anchor/LivingViewPanel // Directory of Anchor mic connection related views└── AnchorLinkControlPanel.swift // Mic connection management panel: can accept audience mic connection, reject audience mic connection, hang up mic connection
// File Location:TUILiveKit/Source/View/LiveRoom/
View/Audience/LivingView
Panel // Directory of Audience mic connection related views├── LinkMicTypePanel.swift // The view that pops up for the audience to choose between voice mic connection or video mic connection└── VideoLinkSettingPanel.swift // The configuration panel view for related parameters during video mic connection
// File location: TUILiveKit/iOS/TUILiveKit/Source/Service/SeatService.swiftfunc takeSeat(index: Int?, requestCallback:@escaping RequestClosure) -> AnyPublisher<TakeSeatResult, InternalError> {return Future<TakeSeatResult, InternalError> { [weak self] promise inguard let self = self else { return }let request = roomEngine.takeSeat(index ?? kRandomSeatIndex , timeout: kTimeoutValue) { requestId, operateUserId in// Callback for the anchor agreeing to the mic connection request} onRejected: { requestId, operateUserId, message in// Callback for the anchor rejecting the mic connection request} onCancelled: { requestId, operateUserId in// Callback for the audience actively canceling the mic connection request} onTimeout: { requestId, operateUserId in// Callback for the audience's mic connection request timeout} onError: { requestId, operateUserId, err, message in// Callback for failed mic connection request}requestCallback(request)}.eraseToAnyPublisher()}
// File location: TUILiveKit/iOS/TUILiveKit/Source/Service/EngineServiceCenter.swiftfunc onRequestReceived(request: TUIRequest) {guard let store = self.store else { return }switch request.requestAction {case .takeSeat:let seatApplication = SeatApplication(request: request)store.dispatch(action: SeatActions.addSeatApplication(payload: seatApplication))let actions: [ActionTemplate<User>] = [SeatActions.addSeatApplicationUser]let param = generateActionTemplateParamTuple(param: request.userId, actions: actions)store.dispatch(action: UserActions.fetchUserInfo(payload: param))case .remoteUserOnSeat:store.dispatch(action: SeatActions.updateReceivedSeatInvitation(payload: SeatInvitation(request: request)))default:break}}
// File location: TUILiveKit/iOS/TUILiveKit/Source/Service/SeatService.swiftfunc cancelRequest(requestId: String) -> AnyPublisher<Void, InternalError> {return Future { [weak self] promise inguard let self = self else { return }roomEngine.cancelRequest(requestId) {promise(.success(()))} onError: { err, message inlet error = InternalError(error: err, message: message)promise(.failure(error))}}.eraseToAnyPublisher()}
// File location: TUILiveKit/iOS/TUILiveKit/Source/Service/EngineServiceCenter.swiftfunc onRequestCancelled(requestId: String, userId: String) {guard let store = self.store else { return }let isContainApplicationRequest = store.selectCurrent(SeatSelectors.getSeatApplications).contains { $0.id == requestId }if isContainApplicationRequest {store.dispatch(action: SeatActions.removeSeatApplication(payload: requestId))}if store.selectCurrent(SeatSelectors.getReceivedSeatInvitation).id == requestId {store.dispatch(action: SeatActions.updateReceivedSeatInvitation(payload: SeatInvitation()))store.dispatch(action: ViewActions.toastEvent(payload: ToastInfo(message: .inviteCancelText)))}}
// File location: TUILiveKit/iOS/TUILiveKit/Source/Service/SeatService.swiftfunc responseRemoteRequest(isAgree: Bool, requestId: String) -> AnyPublisher <Void, InternalError> {return Future { [weak self] promise inguard let self = self else { return }roomEngine.responseRemoteRequest(requestId, agree: isAgree) {promise(.success(()))} onError: { err, message inlet error = InternalError(error: err, message: message)promise(.failure(error))}}.eraseToAnyPublisher()}
// File location: TUILiveKit/iOS/TUILiveKit/Source/Service/SeatService.swiftfunc kickSeat(seat: SeatInfo) -> AnyPublisher<Void, InternalError> {return Future<Void, InternalError> { [weak self] promise inguard let self = self else { return }roomEngine.kickUserOffSeatByAdmin(seat.index, userId: seat.userId) {promise(.success(()))} onError: { err, message inlet error = InternalError(error: err, message: message)promise(.failure(error))}}.eraseToAnyPublisher()}
// File location: TUILiveKit/iOS/TUILiveKit/Source/Service/SeatService.swiftfunc leaveSeat() -> AnyPublisher<Void, InternalError> {return Future<Void, InternalError> { [weak self] promise inguard let self = self else { return }roomEngine.leaveSeat {promise(.success(()))} onError: { err, message inlet error = InternalError(error: err, message: message)promise(.failure(error))}}.eraseToAnyPublisher()}
Was this page helpful?