tencent cloud


Last updated: 2023-09-26 17:01:08
    This document describes how an anchor publishes audio/video streams. "Publishing" refers to turning on the mic and camera to make the audio heard and video seen by other users in the room.

    Step 1. Enter Room

    For detailed directions, see Enter Room.

    Step 2. Turn on camera

    Use the trtc.startLocalVideo() API to turn on the camera and publish it to the room.
    // To preview the camera image, you need to place an HTMLElement in the DOM, which can be a div tag, assuming its id is local-video.
    const view = 'local-video';
    await trtc.startLocalVideo({ view });

    Step 3. Turn on microphone

    Use the trtc.startLocalAudio() API to turn on the microphone and publish it to the room.
    await trtc.startLocalAudio();

    Step 4. Turn off camera/microphone

    Use the trtc.stopLocalVideotrtc.stopLocalAudio to turn off camera/microphone.
    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