Broadcasting on Livepeer

Introduction

This document is a recipe for how to broadcast on Livepeer.

It will explain what equipment you will need to start.

It will also provide a very simple step-by-step method to install and configure the required software.

It may seem long, but it works. I hope. If it doesn't, come and find [me on discord] (https://discord.gg/DCm68PT)

Equipment

In order to create a broadcaster node using Livepeer and Open Broadcast Studio (OBS) you will need:

  • 1 x laptop / desktop / server + peripherals

    • running Linux or Apple Mac (starting from a clean OS install is not required but always preferable)

      • binaries are compiled for x86-64

      • requires MacOS 10.10 or above

    • connected to internet with at least 348kbps upload bandwidth)

      • the minimum bitrate possible to stream from OBS is 232kbps, however we recommend 50% contingency when streaming due to network instabilities.
      • wired Ethernet connection is preferable but not compulsory - Wi-Fi / 4G is also fine
    • with power supply (battery or power supply)

Method

Create a streaming node using Livepeer.

download livepeer software

  • Go to go-livepeer software release page

  • Download the .zip file corresponding to your operating system (Linux, Mac)

  • Extract the content of the .zip file into your favourite folder

Run livepeer

  • open a command-line-interface (such as terminal) in your favourite folder

  • run the following command:

./livepeer -rinkeby -v 6

-rinkeby is to connect to the Rinkeby Ethereum Testnet

-v 6 is to output the highest level of logging

  • create a Passphrase

  • This is used to lock and unlock your account, so keep it safe

  • You will be asked for this every time you start running the node.

  • Enter this Passphrase twice to validate

  • enter the Passphrase again (!)

  • This unlocks the account

When you see the following message, then the streaming node is running:

LPMS Server listening on :1935

configure livepeer

  • open another command-line-interface in your favourite folder

  • run livepeer_cli by executing the following command:

./livepeer_cli
  • This will display the configuration of the node

  • Also, this provides a richer menu-based command-line-interface to help you to get started

  • get test Ethereum

  • ask the livepeer team and we can send you test ETH

  • deposit ETH into your broadcaster account

  • Suggested deposit: 1000

  • this deposit covers your broadcasting costs

  • enter 13 into livepeer_cli to select 13. Deposit (ETH)

  • enter an amount you would like to deposit, and press return

  • This can take up to 10 minutes to arrive, but often happens in seconds, maybe faster

  • You can use Etherscan's Rinkeby Explorer to view the details of your ETH Account.

###You are now ready to broadcast on Livepeer.

Download and install OBS

Configure OBS to broadcast on Livepeer

launch OBS software

  • if you are opening for the first time, cancel the configuration wizard

  • Click Settings in the bottom right hand corner of the screen.

  • Select Stream from the menu on the left of the "Settings" window

  • Under Stream Type select Custom Streaming Server

  • for URL, put rtmp://localhost:1935

  • Click "OK" to close the "Settings" window

  • Under "Sources" click the + and select Text (Freetype 2) 2

  • Click OK

  • In the Text field type HELLO WORLD

  • Click OK

Start broadcasting and monitoring

  • Ensure livepeer is running (see instructions above)

  • Click Start Streaming in OBS.

You are now streaming on Livepeer

Viewing the stream

We can use the Livepeer player but to understand what's happening, let's build our own. Currently most browsers don't support HLS in a standard HTML5 video tag, so we'll need to use a library to help us play the stream. For that we'll use HLS.js. Google Chrome no longer allows videos to autoplay so we'll need to add a button to manually allow the stream to start.
On our html page, we'll load the hls Javascript file, our local javascript file we're calling hlsplayer.js, our css and we'll have a div that contains our video element.

In our Javascript, we need to do a few things:

  • hard code our streamID (which can be found by running curl http://localhost:8935/manifestID which will request the streamId from the livepeer node)
  • Set our source to be 'http://localhost:8935/stream/' + streamId + '.m3u8'
  • Create a new instance of HLS,
    • load the source
    • attach the player to the video element
  • Lastly, let's create a function that runs onLoad which attaches a click handler which runs the HLS play function

If you have your livepeer node running, and a stream coming from obs, open the html file in your browser and you should be able to click the play button and see your stream!

We could also have used the livepeer.js video player to play the video, which is a React component wrapped around HLS.js

Another option is to view your stream using the prebuilt hosted player

That's it!