tencent cloud

Tencent Real-Time Communication

Release Notes and Announcements
Release Notes
Recent Product Announcement
TRTC Live (TUILiveKit) Product Launch Announcement
TRTC Conference Official Editions Launched
The commercial version of Conference is coming soon
Terms and Conditions Applicable to $9.9 Starter Package
Rules for the "First Subscription $100 Discount" Promotion
Announcement on the Start of Beta Testing for Multi-person Audio and Video Conference
TRTC Call Official Editions Launched
License Required for Video Playback in New Version of LiteAV SDK
TRTC to Offer Monthly Packages
Product Introduction
Overview
Concepts
Features
Strengths
Use Cases
Performance Statistics
Tencent RTC Quickplay: Experience Ultimate Real-Time Audio and Video Interaction!
Purchase Guide
Billing Overview
Free Minutes
Monthly subscription
Pay-as-you-go
TRTC Overdue and Suspension Policy
FAQs
Refund Instructions
User Tutorial
Free Demo
Call
Overview
Activate the Service
Run Demo
Integration
Offline Call Push
Conversational Chat
On-Cloud Recording
AI Noise Reduction
UI Customization
Calls integration to Chat
Additional Features
No UI Integration
Server APIs
Client APIs
Solution
ErrorCode
Release Notes
FAQs
Conference
Overview(TUIRoomKit)
Activate the Service (TUIRoomKit)
Run Demo(TUIRoomKit)
Integration(TUIRoomKit)
Screen Sharing (TUIRoomKit)
Schedule a meeting (TUIRoomKit)
In-meeting Call (TUIRoomKit)
UI Customization(TUIRoomKit)
Virtual Background (TUIRoomKit)
Conference Control (TUIRoomKit)
Cloud Recording (TUIRoomKit)
AI Noise Reduction (TUIRoomKit)
In-Conference Chat (TUIRoomKit)
Robot Streaming (TUIRoomKit)
Enhanced Features (TUIRoomKit)
Client APIs (TUIRoomKit)
Server APIs (TUIRoomKit)
FAQs (TUIRoomKit)
Error Code (TUIRoomKit)
SDK Update Log (TUIRoomKit)
Live
Billing of Video Live Component
Overview
Activating the Service (TUILiveKit)
Run Demo
No UI Integration
UI Customization
Live Broadcast Monitoring
Video Live Streaming
Voice Chat Room
Advanced Features
Client APIs
Server APIs
Error Codes
Release Notes
FAQs
RTC Engine
Activate Service
SDK Download
API Examples
Usage Guidelines
API Reference Manual
Advanced Features
AI Integration
Overview
Configure MCP Server
Install Skills
Integration Guide
FAQ
RTC RESTFUL API
History
Introduction
API Category
Room Management APIs
Stream mixing and relay APIs
On-cloud recording APIs
Data Monitoring APIs
Pull stream Relay Related interface
Web Record APIs
AI Service APIs
Cloud Slicing APIs
Cloud Moderation APIs
Making API Requests
Call Quality Monitoring APIs
Usage Statistics APIs
Data Types
Appendix
Error Codes
Console Guide
Application Management
Package Management
Usage Statistics
Monitoring Dashboard
Development Assistance
Solution
Real-Time Chorus
FAQs
Migration Guide
Billing
Features
UserSig
Firewall Restrictions
How to Downsize Installation Package
Android and iOS
Web
Flutter
Electron
TRTCCalling for Web
Audio and Video Quality
Others
Legacy Documentation
RTC RoomEngine SDK(Old)
Integrating TUIRoom (Web)
Integrating TUIRoom (Android)
Integrating TUIRoom (iOS)
Integrating TUIRoom (Flutter)
Integrating TUIRoom (Electron)
TUIRoom APIs
On-Cloud Recording and Playback (Old)
RTC Analytics Monthly Packages (Previous Version)
Protocols and Policies
Compliance
Security White Paper
Notes on Information Security
Service Level Agreement
Apple Privacy Policy: PrivacyInfo.xcprivacy
TRTC Policy
Privacy Policy
Data Processing And Security Agreement
Glossary
DocumentationTencent Real-Time Communication

Mic Connect

Focus Mode
Font Size
Last updated: 2024-12-27 17:14:42
This document mainly introduces how to use the LiveStreamCore module's LiveCoreView to implement Mic Connect.
LiveCoreView supports the following capabilities for Mic Connect:

Prerequisites

Before using LiveStreamCore, you need to integrate and log in to LiveStreamCore to ensure the subsequent features work properly.

Usage guide

Step 1: Adding LiveCoreView to the View

You need to first import the LiveStreamCore module, then create a LiveCoreView view object and add it to your view.
iOS
Android
import LiveStreamCore
import RTCRoomEngine

class AudienceConnectionController: UIViewController {
private let liveCoreView: LiveCoreView = {
let view = LiveCoreView()
return view
}()
override func viewDidLoad() {
super.viewDidLoad()
self.liveCoreView.registerConnectionObserver(observer: self)
// Add liveCoreView to the view and set layout constraints
}
deinit {
self.liveCoreView.unregisterConnectionObserver(observer: self)
}
}
public class AudienceConnectionActivity extends AppCompatActivity implements LiveCoreViewDefine.ConnectionObserver {
private LiveCoreView liveCoreView;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
liveCoreView = new LiveCoreView(this);
addContentView(liveCoreView,
new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));

liveCoreView.registerConnectionObserver(this);
}

@Override
protected void onDestroy() {
super.onDestroy();
liveCoreView.unregisterConnectionObserver(this);
}
}

Step 2: Audience Connection

Request to connect

When you want to connect with someone via mic, call the requestIntraRoomConnection API with three parameters: the userId of the person to connect with, the timeout duration, and whether to turn on the camera.
iOS
Android
let userId = "100012" // Please replace this with the userId of the user you want to initiate Mic Connect with. If you pass an empty string, it will default to connecting with the host.
let timeout = 30 // Replace this with the timeout duration for requesting to speak, in seconds. If set to 0, the SDK will not perform timeout detection or trigger timeout callbacks
let openCamera = true // When you want to initiate a video call, set openCamera to true. For an audio call, set it to false.
self.liveCoreView.requestIntraRoomConnection(userId: userId, timeOut: timeout, openCamera: true) {
// Successfully sent request to connect via mic
} onError: { code, message in
// Failed to send request to connect via mic
}
String userId = "anchorUserId"; // Replace this with the userId of the person you want to connect with via mic
int timeout = 30; // Replace this with the timeout duration for requesting to speak, in seconds. If set to 0, the SDK will not perform timeout detection or trigger timeout callbacks
boolean openCamera = true; // When you want to initiate a video call, set openCamera to true. For an audio call, set it to false.
liveCoreView.requestIntraRoomConnection(userId, timeout, true, new TUIRoomDefine.ActionCallback() {
@Override
public void onSuccess() {
// Successfully sent request to connect via mic
}

@Override
public void onError(TUICommonDefine.Error error, String message) {
// Failed to send request to connect via mic
}
});
When you are the invitee for a connection, you will receive the onUserConnectionRequest callback. You can call the respondIntraRoomConnection API to accept or reject the connection.
iOS
Android
func onUserConnectionRequest(inviterUser: TUIUserInfo) {
let isAccepted = true // true: accept connection, false: reject connection
self.liveCoreView.respondIntraRoomConnection(userId: inviterUser.userId, isAccepted: isAccepted) {
// Response succeeded
} onError: {code, message in
// Response failed
}
}
@Override
public void onUserConnectionRequest(TUIRoomDefine.UserInfo userInfo) {
boolean isAccepted = true; // true: accept connection, false: reject connection
liveCoreView.respondIntraRoomConnection(userInfo.userId, isAccepted, new TUIRoomDefine.ActionCallback() {
@Override
public void onSuccess() {
// Response succeeded
}

@Override
public void onError(TUICommonDefine.Error error, String message) {
// Response failed
}
});
}

Audience terminate connection

If you do not want to connect with the host, call the terminateIntraRoomConnection API to disconnect.
iOS
Android
self.liveCoreView.terminateIntraRoomConnection()
liveCoreView.terminateIntraRoomConnection();

Host terminate connection

If you want to interrupt the connection with an audience member, call the disconnectUser API and pass in the corresponding user's userId.
iOS
Android
let targetUserId = "100010" // Replace this with the userId of the audience member you want to disconnec
self.liveCoreView.disconnectUser(userId: targetUserId) {
// Successfully disconnected
} onError: { code, message in
// Failed to disconnect
}
String targetUserId = "100010"; // Replace this with the userId of the audience member you want to disconnect from
liveCoreView.disconnectUser(targetUserId, new TUIRoomDefine.ActionCallback() {
@Override
public void onSuccess() {
// Successfully disconnected
}

@Override
public void onError(TUICommonDefine.Error error, String message) {
// Failed to disconnect
}
});

Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback