Skip to main content
Version: 0.1.x

RTMP Livestream - React Native

RTMP is a widely used protocol for live streaming video content from VideoSDK to platforms like YouTube, Twitch, Facebook, and others.

To initiate live streaming from VideoSDK to platforms supporting RTMP ingestion, you simply need to provide the platform-specific stream key and stream URL. This enables VideoSDK to connect to the platform's RTMP server and transmit the live video stream.

Furthermore, VideoSDK offers flexibility in configuring livestream layouts. You can achieve this by either selecting different prebuilt layouts in the configuration or by providing your custom template for livestreaming, catering to your specific layout preferences.

This guide will provide an overview of how to implement starting and stopping RTMP livestreaming with VideoSDK.


The startLivestream() method, accesible from the useMeeting hook, is used to initiate the RTMP livestream of a meeting. This method accepts the following two parameters:

  • 1. outputs: This parameter takes an array of objects containing the RTMP url and streamKey specific to the platform where you want to initiate the livestream.

  • 2. config (optional): This parameter defines the layout configuration for the livestream.

    const config = {
    // Layout Configuration
    layout: {
    type: "GRID", // "SPOTLIGHT" | "SIDEBAR", Default : "GRID"
    priority: "SPEAKER", // "PIN", Default : "SPEAKER"
    gridSize: 4, // MAX : 4

    // Theme of RTMP
    theme: "DARK", // "LIGHT" | "DEFAULT"

    const outputs = [
    url: "<RTMP_URL>",
    streamKey: "<RTMP_STREAM_KEY>",

    startLivestream(outputs, config);


The stopLivestream() method, accesible from the useMeeting hook, is used to stop the RTMP livestream of a meeting.


import { useMeeting } from "";
import { TouchableOpacity, Text } from "react-native";

const MeetingView = () => {
const { startLivestream, stopLivestream } = useMeeting();

const handleStartLivestream = () => {
// Start Livestream
url: "rtmp://",
streamKey: "key",
layout: {
type: "GRID",
priority: "SPEAKER",
gridSize: 4,
theme: "DARK",

const handleStopLivestream = () => {
// Stop Livestream

return (
onPress={() => {
<Text>Start Livestream</Text>

onPress={() => {
<Text>Stop Livestream</Text>

Event associated with Livestream

  • onLivestreamStateChanged - The onLivestreamStateChanged() event is triggered whenever the state of meeting livestream changes.
import { Constants, useMeeting } from "";

function onLivestreamStateChanged(data) {
const { status } = data;

if (status === Constants.livestreamEvents.LIVESTREAM_STARTING) {
console.log("Meeting livestream is starting");
} else if (status === Constants.livestreamEvents.LIVESTREAM_STARTED) {
console.log("Meeting livestream is started");
} else if (status === Constants.livestreamEvents.LIVESTREAM_STOPPING) {
console.log("Meeting livestream is stopping");
} else if (status === Constants.livestreamEvents.LIVESTREAM_STOPPED) {
console.log("Meeting livestream is stopped");
} else {

const {
} = useMeeting({

Custom Template

With VideoSDK, you can also use your own custom designed layout template to record the meetings. In order to use the custom template, you need to create a template for which you can follow this guide. Once you have setup the template, you can use the REST API to start the recording with the templateURL parameter.

API Reference

The API references for all the methods utilised in this guide are provided below.

Got a Question? Ask us on discord