tencent cloud

Feedback

Scenario Solution

Last updated: 2024-07-25 17:02:41

    Scene Introduction

    The live showroom scenario is a video interaction scenario under the social entertainment mode. It supports multi-user video mic connect, making it easier to engage users in mic connect, thus boosting user spending willingness and stickiness. Moreover, the live showroom also supports cross-room competition between anchors from different rooms, further enhancing the fun of live streaming. Cross-room competition with latency below 300 ms, supporting audience and anchor mic connecting, smooth on/off mic switching, meets the high-frequency interaction demands of the live showroom scenario. The intelligent beauty feature also meets the personalized needs of anchors, making live streaming more appealing.
    
    
    

    Implementation Scheme

    Typically, implementing a complete live showroom scenario involves several functional modules: Room Management, Seat Management, Media Stream Management, On-Cloud Recording, etc. The key actions and feature points under each feature module are shown in the table below. Each functional module will be introduced individually to provide a comprehensive understanding of the functionalities required for building a live showroom scenario.
    Feature Module
    Key Actions and Feature Points
    Room management
    Room list, create a room, enter a room, exit a room, and terminate a room.
    Seat Management
    Request to speak, become a listener, invite a listener to speak, remove a speaker, and mute a speaker.
    Media Stream Management
    RTC Real-Time Interaction Solution
    On-cloud recording
    TRTC on-cloud recording.
    The overall business architecture of the live showroom scenario is shown in the figure below. The room owner creates a room, and users can choose to enter rooms that interest them. Users who enter the room can become speakers to participate in audio and video interactions with the anchor via the mic. Typically, due to compliance requirements, the audio and video content in the room needs to be recorded and submitted for review.
    
    
    
    Note:
    Relayed push and recording reviews can be configured to use either target single streams or mix streams based on specific business requirements.
    The recording and review process can be implemented using either RTC Recording Review or CDN Recording Review, depending on specific business requirements.

    Room management

    The Room Management Module is primarily responsible for maintaining the room list and includes the following features:
    Create Room: After users log in to the business system, they can create a room. The room list needs to be updated after a room is created.
    Enter a Room: Users can choose to enter an existing room. Upon entering, the current list of room members should be updated.
    Exit a Room: Users can choose to exit the current room. Upon exiting, the current list of room members needs to be updated with a delete operation.
    Destroy a Room: After all users exit the room, it needs to be destroyed. Upon destruction, the room list needs to be updated with a delete operation.
    Note:
    Room Management is a necessary module for implementing a live showroom, but it is not the main functional module. It can be implemented in conjunction with the business system and IM&TRTC SDK, see Voice Chat Room - Room Management for details.

    Seat Management

    Seats in a live streaming room are generally ordered and limited. Seat Management is primarily responsible for defining the number of seats in a room based on the business scene, as well as managing the status of all seats in the current room. Seat Management mainly includes: request to speak, become a listener, invite a listener to speak, remove a speaker, and mute a speaker.
    After users enter a room, only idle seats can be applied for.
    After the room owner approves a user to become a speaker, the seat status needs to be changed to non-idle.
    After the user stops streaming and becomes a listener, the seat status needs to be reset.
    The room owner has the authority to lock the seat, invite a listener to speak, remove a speaker, mute a speaker, etc.
    Note:
    Seat Management is a necessary module for implementing a live showroom, but it is not the main functional module. It can be implemented in conjunction with the business system and IM&TRTC SDK, see Voice Chat Room - Seat Management for details.

    Media Stream Management

    For ordinary live showroom scenarios, we recommend the RTC real-time interaction solution: both anchors and audience use the RTC protocol for publishing/playback, minimizing end-to-end latency and ensuring a smoother experience for the audience when joining and leaving the mic, without abrupt changes such as image fast-forwarding or rewinding. Taking the example of multi-person co-anchoring live streaming interactions, the main architecture of live showroom in a pure RTC publishing/playback scenario is shown in the figure below:
    
    
    
    The overall process of this solution is as follows:
    1. Both the anchor and audience connect through the signaling module, which is mainly responsible for controlling the live streaming process and synchronizing the live streaming status.
    2. Regardless of whether there are mic-connecting audiences or not, both the anchor and the audience use the TRTC audio and video cloud service for publishing/playback.
    3. After the audience requests to mic connect with the anchor, the signaling module will notify the anchor and synchronize the personal information of the co-speakers.
    4. Once the anchor accepts the mic connection request, the mic-connecting audience starts streaming, and all members in the room receive stream update notifications and pull the audio-video stream of the mic-connecting audience.
    5. When a mic-connecting audience member requests to disconnect, they stop streaming. All members in the room will receive stream update notifications and stop pulling that audience's audio and video stream.
    Note:
    The signaling module can be a custom-developed signaling channel, and it is also recommended to use Instant Messaging (IM) for signaling interaction.

    On-cloud recording

    TRTC's newly upgraded on-cloud recording does not depend on cloud streaming services. It does not require a relayed push for cloud live streaming and uses TRTC's internal real-time recording cluster for audio and video recording, offering a more comprehensive and unified recording experience.
    Single Stream Recording: With TRTC's on-cloud recording feature, you can record the audio and video stream of each user in the room into separate files.
    
    
    
    Mix Stream Recording: Record the audio-video media streams of the same room as a single file.
    
    
    
    Note:
    For a detailed introduction and activation guide to TRTC On-Cloud Recording, see On-Cloud Recording.
    In the live showroom scenario, a common approach for recording is the mixed-stream recording solution, while the single stream recording solution can be chosen if there is a need for single stream review of the anchor or the mic-connecting audience.

    Key Business Logic

    Gift and Like Messages

    In the live showroom scenario, gifts and likes are common ways of interaction. Audiences can express their love and support for the anchor by giving gifts and likes, and the anchor can also earn revenue from them. Below, we will introduce the implementation of gift and like messages based on Tencent Cloud Instant Messaging.

    Gift message

    
    
    
    1. Non-persistent connection requests from the client to their business server involve gift billing logic.
    2. After billing, the sender directly sees XXX gave XXX a gift (to ensure the sender sees the gift they sent themselves; when the message volume is large, it may trigger an abandonment strategy).
    3. After billing is settled, the client calls the server API Sending Custom Messages in a Group (gift).
    4. If encountering scenarios of rapid gift giving, you need to merge the messages:
    If users directly select the number of gifts, such as choosing 99 gifts, the system should send a single message with the parameter set to 99 gifts.
    If the gifts are in a combo and it's uncertain how many there will be, the business backend can merge every 20 (quantity adjustable) or send one for combos lasting over 1 second. Following this logic, for example, for a combo of 99 gifts, only 5 messages would need to be sent after optimization.
    An example request package for server API sending custom messages in a group is as follows, where MsgBody supports customizing message elements.
    {
    "GroupId": "@TGS#12DEVUDHQ",
    "Random": 2784275388,
    "MsgPriority": "High", // The priority of the message. Gift messages should be set to high priority.
    "MsgBody": [
    {
    "MsgType": "TIMCustomElem",
    "MsgContent": {
    // type: gift type; giftUrl: gift resource URL; giftName: gift name; giftCount: number of gifts.
    "Data": "{\\"cmd\\": \\"gift_msg\\", \\"msg\\": {\\"type\\": 1, \\"giftUrl\\": \\"xxx\\", \\"giftName\\": \\"xxx\\", \\"giftCount\\": 1}}"
    }
    }
    ]
    }

    Like message

    
    
    
    1. Likes do not involve billing and are typically sent directly from the client using sending custom messages in a group.
    2. For like messages that need to be counted on the server, after traffic throttling is performed on the client, likes on the client are counted, and like messages within a short period of time are merged into one. The business server gets the count of likes in the callback after sending a group message for statistics.
    3. For like messages that do not require counting, follow the same logic as step 2. Throttle the likes messages on the client side and send them. There is no need to count them in the callback after sending the group message.
    Note:
    Please set important messages to high priority (e.g., gift messages) and high-frequency but not important messages to low priority (e.g., like messages).
    Specific implementation steps for live streaming interaction features (such as likes, gifts, and on-screen comment chat) can be seen in Quick Integration Guide - Live Streaming Interactive Messages.

    Integrating Beauty Effect

    In the live showroom scenario, the beauty effect is a frequently used feature. It not only improves the beauty of the anchor but also adds fun to live interaction through various sticker effects. TRTC supports the integration of Tencent Effect SDK as well as the integration of mainstream third-party beauty effect products in the market, such as Volcano Beauty, FaceUnity, etc.

    Beauty Effect Integration Process

    
    
    

    API Call Sequence

    
    
    

    Comparison of Beauty Products

    Beauty Type
    Beauty Effect
    Access Costs
    Fees
    Virtual AI Digital Human
    Support Terminal
    The basic effect is good, advanced effect for big eyes/slim faces is significant.
    Low
    Moderate
    Supported
    Android/iOS/PC/Flutter/Web/Mini Program
    The basic effect is good, advanced effects like big eyes/slim faces are average.
    Moderately high
    Moderate
    Supported
    Android/iOS/PC/Untiy
    The basic effect is good, advanced effects like big eyes/slim faces are relatively good.
    Moderately high
    Relatively High
    Supported
    Android/iOS/PC/Linux

    Cross-Room Competition

    Cross-room competition between anchors is a common gameplay in live showroom scenarios. It enhances the fun of interactive live streaming and stimulates the audience's desire to rank and give gifts. TRTC supports multiple rooms and cross-room competition between multiple anchors. Below are the specific implementation methods.
    1. How It Works
    By default, only users in the same room can have audio and video calls, and the audio and video streams between different rooms are isolated. Through the cross-room competition, the audio and video streams of an anchor in another room can be published in the current room, while the audio and video streams of the current anchor will also be published in the target anchor's room. This allows anchors in different rooms to share audio and video streams across rooms, enabling audiences in each room to watch the audio and video of both anchors.
    
    
    
    The figure above shows the main process of cross-room competition. For example: After anchor A in room 101 establishes a cross-room call with anchor B in room 102 using ConnectOtherRoom():
    Users in room 101 will receive two event callbacks from anchor B: onRemoteUserEnterRoom(B) and onUserVideoAvailable(B,true). Therefore, users in room 101 can subscribe to the audio and video of anchor B.
    Users in room 102 will receive two event callbacks from anchor A: onRemoteUserEnterRoom(A) and onUserVideoAvailable(A,true). Therefore, users in room 102 can subscribe to the audio and video of anchor A.
    Note:
    Both local and peer users participating in cross-room competition must be in the anchor role and must have audio/video uplink capabilities.
    Cross-room mic-connection PK with multiple room anchors can be achieved by calling ConnectOtherRoom() multiple times. Currently, a room can connect with up to three other room anchors at most, and up to 10 anchors in a room can conduct cross-room mic-connection competition with anchors in other rooms.
    TRTC cross-room competition can also be achieved by createSubCloud() to create a sub-instance and join the publishing/playback of another room. Currently, there is no limit to the number of sub-instances, facilitating the future expansion of business scenes involving PK between multiple rooms or anchors.
    2. Real-Time Interactive Cross-Room Competition Process
    In a pure RTC scenario, the cross-room competition process is straightforward. Anchors and cross-room competition anchors mutually pull RTC single streams, and the audience simultaneously pulls the RTC single streams of both anchors and cross-room competition anchors. The audience can independently control the subscription logic of the media streams of anchors and cross-room connecting anchors. The real-time interactive cross-room call process is shown in the diagram below.
    
    
    
    Note:
    In real-time interactive cross-room competition scenes, audiences in the room can independently control the logic of subscribing to the media streams of cross-room connecting anchors, or it can be changed by the room owner to <1>change the uplink capability of a cross-room anchor in their rooms<1>.

    Scene Approach

    Single-Anchor Live Streaming

    A live streaming room with only one anchor is called single-anchor live streaming. In this scenario, the room owner is the only anchor. The audience can join the live stream, watch the live streaming, send messages, and give gifts to the room owner.

    Multi-Person Co-Anchoring Live Streaming

    Multi-person co-anchoring live streaming refers to a scenario where multiple anchors engage in real-time audio and video interactions within the live streaming room. The room owner can invite a listener to speak and control the seats; audiences can also request to speak to interact with the anchor.

    Cross-Room Competition Live Streaming

    In the live streaming room, to enhance the atmosphere and quickly attract followers, the room owner can invite another anchor from a different live room to engage in mic connecting or online PK. The audience in the mic-connected live streaming room can simultaneously watch the interaction between the two anchors and send gifts based on their performance, or quickly switch between live streaming rooms to vote for different room owners. This is a typical scenario for video competition live streaming.

    Live Shopping

    Live shopping combines e-commerce with video interactive live streaming. In the live streaming room, the anchor introduces products to the audience and provides product lists and links; the audience can click the link to place orders quickly for products they like. During the live streaming, the audience can become a speaker to interact with the room owner in real-time, such as asking about product details, negotiating prices, and sharing their experience of using the products; the room owner can also engage in competition live streaming with another room's owner, showcasing their products to inspire the audience's purchasing enthusiasm and add fun to the live streaming.

    Alternative Solutions

    In addition to the recommended RTC Real-Time Interaction Solution, live showroom scenarios usually have an alternative solution: RTC CDN Live Streaming Solution.

    RTC CDN Live Streaming Solution

    The anchor uses the RTC protocol for streaming and relayed push of Tencent Cloud Streaming Services or third-party live streaming. General audiences pull the CDN stream to watch while mic-connecting audiences engage in interactive co-anchoring by switching to the RTC protocol for streaming. This solution is a commonly used compromise, with higher latency for both watching and mic connecting on the audience side. However, it offers advantages in terms of cost-effectiveness and audience scalability. The publishing/playback architecture is shown in the diagram below:
    
    
    
    The overall process of this solution is as follows:
    1. The anchor enters the TRTC room, streams via the RTC protocol, and relays to Cloud Streaming Services.
    2. Non-mic audience pull the CDN accelerated stream for watching through V2TXLivePlayer.
    3. Audiences can request to speak and become the mic-connecting audiences. They stop the CDN streaming and switch to the RTC protocol for publishing/playback.
    4. Audiences off the mic become general audiences. They stop the RTC protocol publishing/playback and switch to the CDN streaming.
    CDN playback addresses support multiple protocols such as RTMP/FLV/HLS/WebRTC, with splicing rules detailed in Splicing Playback URL.
    Different live streaming playback protocols have varying compatible platforms, play delays, and billing rules. See the table below for details:
    Live Streaming Protocol
    Advantage
    Disadvantage
    Playback Latency
    FLV
    Mature, suited for high-concurrency scenarios
    Requires integration of SDK for playback
    2s - 3s
    RTMP
    Relatively low latency
    Poor performance in high-concurrency scenarios
    1s - 3s
    HLS(M3U8)
    Well supported on mobile browsers
    High latency
    10s - 30s
    WebRTC
    Lowest latency
    Requires integration of SDK for playback
    < 1s
    Note:
    Tencent Cloud Streaming Services supports multiple playback protocols. You can choose the appropriate pull stream solution based on your business needs. For example, for delay-sensitive businesses, LEB pulling stream is recommended.
    HLS and WebRTC playback protocols support the adaptive bitrate feature, which allows smooth switching of playback bitrate under different network conditions. See Adaptive Bitrate for details.

    Smooth Mic On/Off Handling

    In single-anchor low-frequency mic connection live streaming scenes, due to cost considerations, RTC CDN live streaming solutions or third-party live streaming publishing/playback solutions are often used. In single-anchor streaming, the anchor streams via RTC or third-party live streaming, while audiences pull streams via CDN. In interactive co-anchoring scenes, both the anchor and audiences stream via RTC. This involves switching between publishing/playback tools while maintaining a seamless experience for users. Below are the specific methods for smooth mic on/off handling in both the RTC CDN live streaming and third-party live streaming publishing/playback solutions.
    1. RTC CDN Live Streaming Solution
    Under the RTC CDN live streaming solution, the anchor always uses the TRTC SDK for publishing/playback. During mic connects, only the mic-connecting audience needs to switch the publishing/playback tools, and the rendering control can be reused.
    
    
    
    2. Third-Party Live Streaming Publishing/Playback Solution
    In the third-party live streaming publishing/playback solution, during mic connects, both the anchor and the mic-connecting audience need to switch the publishing/playback control. It is recommended to use TRTC's custom capture and rendering features.
    
    
    
    Note:
    Smooth Mic on: To avoid screen interrupts when switching the stream puller, it is suggested to wait for the TRTC's first frame callback onFirstVideoFrame before stopping the CDN streaming.
    Smooth Mic off: To avoid screen interrupts when switching the stream puller, it is suggested to wait for the video play event onVideoPlaying before stopping the RTC streaming.

    CDN Live Streaming in Cross-Room Competition

    In the RTC CDN live streaming scenario, the process of cross-room competition is relatively complex. Anchors pull RTC single streams from each other and CDN audiences pull the mixed streams from both the anchor and the cross-room competition anchor. Audiences cannot independently control the subscription logic of the anchor and cross-room competition anchor's media streams. The process for cross-room calls in a CDN live streaming scenario is shown in the diagram below:
    
    
    
    Note:
    In the CDN live streaming in cross-room competition scene, CDN audiences cannot independently control the subscription logic of the cross-room connected anchor's media stream. It needs to be uniformly controlled by the anchor through updating and publishing the media stream.

    Supporting Products for the Solution

    System Level
    Product
    Application Scenes
    Access layer
    Provides a low-latency, high-quality multi-person audio and video real-time interaction live streaming solution, which is a foundational capability for live showroom scenarios.
    Access layer
    Provides room management and seat management capabilities based on group features, enables the sending and receiving of rich media messages such as live streaming room-wide messaging, public screen messages, as well as custom signaling and other communication needs.
    Access layer
    Provides real-time effects processing capabilities such as beauty, filtering, makeup, fun stickers, emojis, and virtual avatars.
    Cloud Services
    Provides real-time audio and video relayed push, along with accelerated media stream distribution services, as well as additional capabilities such as recording and pornography detection.
    Cloud Services
    Catering to media such as audio, video, and images, it offers an integrated high-quality media service that includes creation, upload, storage, transcoding, media processing service, media AI, accelerated distribution and playback, and copyright protection.
    Data storage
    Provides storage services for audio and video recording files, as well as audio and video slicing files.
    
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support