LiveView of the AtomicXCore SDK to quickly build a basic live streaming web application featuring host broadcasting and audience viewing capabilities.LiveView is a core video display component purpose-built for live streaming scenarios. It provides the foundation for building live broadcast interfaces, abstracting all underlying streaming technologies—including stream publishing and playback, co-hosting, and audio/video rendering. Treat LiveView as the "canvas" for your live video, enabling you to focus on developing your UI and interactive features. The following view hierarchy diagram illustrates the role and placement of LiveView within a typical live streaming interface:
AtomicXCore SDK is designed for Vue 3 projects. Ensure your development environment is compatible with Vue 3 before proceeding.tuikit-atomicx-vue3 package using one of the following commands:npm install tuikit-atomicx-vue3 --save
pnpm add tuikit-atomicx-vue3
yarn add tuikit-atomicx-vue3
login method from useLoginState() in your project to authenticate. Logging in is required before you can use any AtomicXCore functionality.login method in useLoginState only after your own user account login is successful. This ensures clarity and consistency in your authentication logic.import { useLoginState } from 'tuikit-atomicx-vue3';const { login } = useLoginState();async function initLogin() {try {await login({sdkAppId: 0, // Replace with your sdkAppIduserId: "", // Replace with your userIduserSig: "" // Replace with your userSig});} catch (error) {console.error("login failed:", error);}}initLogin(); // Call initLogin when the component mounts or at the appropriate time
Parameter | Type | Description |
sdkAppId | int | |
userId | string | Unique identifier for the current user. Use only letters, numbers, hyphens, and underscores. Avoid simple IDs like 1, 123, etc., to prevent multi-device login conflicts. |
userSig | string | A ticket for Tencent Cloud authentication. Please note: Development Environment: You can use the local GenerateTestUserSig.genTestSig function to generate a UserSig or generate a temporary UserSig via the UserSig Generation Tool.Production Environment: To prevent key leakage, you must use a server-side method to generate UserSig. For details, see Generating UserSig on the Server. |

StreamMixer component:<template><StreamMixer /></template><script setup lang="ts">import { StreamMixer } from 'tuikit-atomicx-vue3';</script>
openLocalCamera and openLocalMicrophone methods from useDeviceState to enable the camera and microphone. StreamMixer will automatically preview the current camera video stream.import { onMounted } from 'vue';import { useDeviceState } from 'tuikit-atomicx-vue3';const { openLocalCamera, openLocalMicrophone } = useDeviceState();onMounted(() => {openLocalMicrophone();openLocalCamera();})
createLive method from useLiveListState to start streaming:import { useLiveListState } from 'tuikit-atomicx-vue3';const { createLive } = useLiveListState();// Define the live room ID, typically generated by the backend or passed via route parametersconst liveId = ref('test_live_room_001');async function startLive() {try {await createLive({liveId: liveId.value, // Set the live room IDliveName: 'test Live', // Set the live room name});} catch (error) {console.error('Failed to create live:', error);}}
Parameter Name | Type | Attribute | Description |
liveId | string | Required | Unique identifier for the live room |
liveName | string | Required | Title of the live room |
notice | string | Optional | Announcement for the live room |
isMessageDisableForAllUser | boolean | Optional | Mute all users ( true: yes, false: no) |
isPublicVisible | boolean | Optional | Publicly visible ( true: yes, false: no) |
isSeatEnabled | boolean | Optional | Enable seat feature ( true: yes, false: no) |
keepOwnerOnSeat | boolean | Optional | Keep host on seat |
maxSeatCount | number | Optional | Maximum number of seats |
seatMode | string | Optional | Seat mode ( 'FREE': free to become a co-host, 'APPLY': request access to become a co-host) |
seatLayoutTemplateId | number | Optional | Seat layout template ID |
coverUrl | string | Optional | Cover image URL for the live room |
backgroundUrl | string | Optional | Background image URL for the live room |
categoryList | number[] | Optional | List of category tags for the live room |
activityStatus | number | Optional | Live activity status |
isGiftEnabled | boolean | Optional | Enable gift feature ( true: yes, false: no) |
isLikeEnabled | boolean | Optional | Enable likes ( true: yes, false: no) |
endLive method from useLiveListState. The SDK will automatically stop the stream and destroy the room.import { useLiveListState } from 'tuikit-atomicx-vue3';const { endLive } = useLiveListState();// End live streamingasync function stopLive() {try {await endLive();} catch (error) {console.error('Failed to end live:', error);}}

LiveView component:<template><LiveView /></template><script setup lang="ts">import { LiveView } from 'tuikit-atomicx-vue3';</script>
joinLive method from useLiveListState to enter the live room. LiveView will automatically play the video stream for the current room.import { useLiveListState } from 'tuikit-atomicx-vue3';const { joinLive } = useLiveListState();// Define the live room ID to enterconst liveId = ref('test_live_room_001');// Enter the live roomasync function joinLiveRoom() {try {await joinLive({ liveId: liveId.value }); // Use the same liveId as the host} catch (error) {console.error('Failed to enter live room:', error);}}
leaveLive method from useLiveListState. The SDK will automatically stop playback and exit the room.import { useLiveListState } from 'tuikit-atomicx-vue3';const { leaveLive } = useLiveListState();// Exit live streamingasync function exitLive() {try {await leaveLive();// You can perform page navigation here} catch (error) {console.error('Failed to leave live room:', error);}}
subscribeEvent from useLiveListState:import { useLiveListState, LiveListEvent } from "tuikit-atomicx-vue3";import { onMounted, onUnmounted } from 'vue';const { subscribeEvent, unsubscribeEvent } = useLiveListState();const handleKickedOutOfLive = () => {console.log('You have been removed from the live room');};const handleLiveEnded = () => {console.log('Live has ended');};onMounted(() => {subscribeEvent(LiveListEvent.onLiveEnded, handleLiveEnded);subscribeEvent(LiveListEvent.onKickedOutOfLive, handleKickedOutOfLive);});onUnmounted(() => {unsubscribeEvent(LiveListEvent.onLiveEnded, handleLiveEnded);unsubscribeEvent(LiveListEvent.onKickedOutOfLive, handleKickedOutOfLive);});
LiveView, you will have a clean video rendering area with full live streaming capabilities, but no interactive UI. See the next section, Enhancing the Live Experience, to add interactive features to your live stream.Live Feature | Feature Description | Feature State | Implementation Guide |
Enable Audience Audio/Video Link | Audience can request to join the stream and interact with the host via real-time video. | Implement audience linking | |
Enable Host Cross-Room PK | Hosts from two different rooms can connect for interaction or PK. | Implement host PK linking | |
Add Bullet Chat Feature | Audience can send and receive real-time text messages in the live room. | Implement bullet chat |
State | Feature Description | API Documentation |
LiveListState | Full lifecycle management of live rooms: create, enter, leave, destroy room, query room list, modify live info (name, announcement, etc.), listen for live status (such as being removed, ended). | |
DeviceState | Audio/video device control: microphone (switch, volume), camera (switch, switch camera, video quality), screen sharing, real-time device status monitoring. | |
CoGuestState | Audience linking management: link request, invitation, approval, rejection, member permissions control (microphone, camera), status synchronization. | |
CoHostState | Host cross-room linking: supports multiple layout templates (dynamic grid, etc.), initiate, accept, reject linking, co-host interaction management. | |
BarrageState | Bullet chat feature: send text or custom bullet chat, maintain bullet chat list, real-time bullet chat status monitoring. | |
LiveAudienceState | Audience management: get real-time audience list (ID, name, avatar), count audience number, listen for audience entry/exit events. |
login method before invoking broadcast or viewing interfaces.openLocalCamera() to enable the camera.StreamMixer component.LiveView component.tuikit-atomicx-vue3.localhost or 127.0.0.1. In production, use HTTPS.Feedback