caution
Go Live On Social Media
This feature allows participant to broadcast meeting on various social media platforms such as Facebook or Youtube. This guide will provide an overview of how participant can start and stop broadcasting meeting.
- Start LiveStream - By using 
startLivestream()function, a participant can start broadcasting meeting on various platforms by provding url and stream keys as an argument. - Stop LiveStream - By using 
stopLivestream()function, a participant can stop broadcasting on all platforms. 
Start And Stop Live Stream
- JavaScript
 - React
 - ReactNative
 - Android
 - IOS
 - Flutter
 
const onPress = () => {
  // Start Live Stream
  meeting?.startLivestream([
    {
      url: "rtmp://a.rtmp.youtube.com/live2",
      streamKey: "key",
    },
  ]);
  // Stop Live Stream
  meeting?.stopLivestream();
};
const onPress = () => {
  // Start Live Stream
  meeting?.startLivestream([
    {
      url: "rtmp://a.rtmp.youtube.com/live2",
      streamKey: "key",
    },
  ]);
  // Stop Live Stream
  meeting?.stopLivestream();
};
const onPress = () => {
  // Start Live Stream
  meeting?.startLivestream([
    {
      url: "rtmp://a.rtmp.youtube.com/live2",
      streamKey: "key",
    },
  ]);
  // Stop Live Stream
  meeting?.stopLivestream();
};
private static final String YOUTUBE_RTMP_URL = null;
private static final String YOUTUBE_RTMP_STREAM_KEY = null;
//
findViewById(R.id.btnLivestream).setOnClickListener(view -> {
    if (!livestreaming) {
        if (YOUTUBE_RTMP_URL == null || YOUTUBE_RTMP_STREAM_KEY == null) {
            throw new Error("RTMP url or stream key missing.");
        }
        List<LivestreamOutput> outputs = new ArrayList<>();
        outputs.add(new LivestreamOutput(YOUTUBE_RTMP_URL, YOUTUBE_RTMP_STREAM_KEY));
        meeting.startLivestream(outputs);
    } else {
        meeting.stopLivestream();
    }
});
/// keep track of livestream
private var livestreamStarted = false
@IBAction func livestreamButtonTapped(_ sender: Any) {
    if !livestreamStarted {
        // prepare output
        // specify social-media-url and stream-key
        let output = LivestreamOutput(url: "<rtmp://a.rtmp.youtube.com/live2>", streamKey: "<stream-key>")
        // start livestream
        self.meeting?.startLivestream(outputs: [output])
    }
    else {
        // stop livestream
        self.meeting?.stopLivestream()
    }
}
// Start Live Stream
meeting.startLivestream([
  {
    url: "rtmp://a.rtmp.youtube.com/live2",
    streamKey: "streamKey1",
  },
]);
// Stop Live Stream
meeting?.stopLivestream();
Events
- 
livestream-started - Whenever broadcasting of meeting started,
livestream-startedevent will trigger. - 
livestream-stopped - Whenever broadcasting of meeting stopped,
livestream-stoppedevent will trigger. 
- JavaScript
 - React
 - ReactNative
 - Android
 - IOS
 - Flutter
 
meeting.on("livestream-started", () => {
  console.log("LiveStream Started");
});
meeting.on("livestream-stopped", () => {
  console.log("LiveStream Stopped");
});
import { useMeeting } from "@videosdk.live/react-sdk";
/** useMeeting hooks events */
const {
  /** Methods */
} = useMeeting({
  onLiveStreamstarted: () => {
    console.log("LiveStream Started");
  },
  onLiveStreamStopped: () => {
    console.log("LiveStream Stopped");
  },
});
import { useMeeting } from "@videosdk.live/react-native-sdk";
/** useMeeting hooks events */
const {
  /** Methods */
} = useMeeting({
  onLiveStreamstarted: () => {
    console.log("LiveStream Started");
  },
  onLiveStreamStopped: () => {
    console.log("LiveStream Stopped");
  },
});
new MeetingEventListener() {
  @Override
  public void onLivestreamStarted() {
      livestreaming = true;
      // TODO: show indication that meeting livestream is started.
  }
  @Override
  public void onLivestreamStopped() {
      livestreaming = false;
      // TODO: show indication that meeting livestream is stopped.
  }
}
/// Called after livestream starts
func onLivestreamStarted() {
    liveStreamStarted = true
    // show indication that livestream is started
}
/// Called after livestream stops
func onLivestreamStopped() {
    liveStreamStarted = false
    // hide livestream indication
}
meeting.on("livestream-started", () {
  print("meeting livestream started");
});
//
meeting.on("livestream-stopped", () {
  print("meeting livestream stopped");
});
Got a Question? Ask us on discord

