Creating and watching a livestream is easy! The example below uses Create Stream API to create and watch a livestream.

Stream Creation

We can use the Livepeer SDK to create a stream. The example below uses the Create Stream API.

import { Livepeer } from "livepeer";

const apiKey = 'YOUR_API_KEY';

const livepeer = new Livepeer({apiKey});

const streamData = {
  name: "test_stream"

  .then((response) => {
    console.log("Stream created:", response);
  .catch((error) => {
    console.error("Error creating stream:", error);

You can find all the information required to broadcast to the stream in the response object.

The RTMP ingest URL of Livepeer Studio is rtmp://, and the streamKey is present in the response object. You can use these two values to broadcast to the stream.

You can also use WebRTC WHIP to broadcast, using the URL{streamKey}. This is used for in-browser broadcasting.

To learn more about other stream functions such as stopping a stream, recording a stream, and more, see the Stream API.

Play a Stream

To learn how to play a stream, see the Play a Livestream guide.