webrtc-tmp-republish-youtube-testing-title

Testing WebRTC broadcasting to the RTMP Server

We test WebRTC broadcasting of a video stream from the Google Chrome browser with intermediate republishing via the RTMP protocol. We will use the demo example WebRTC as RTMP re-publishing available at: https://wcs5-eu.flashphoner.com/demo2/webrtc-rtmp-republishing. For testing, we will need the latest version of Google Chrome and a built-in or USB web camera (a virtual camera is also fine).

 

Open the demo page in Google Chrome and click the Start button. Allow the page to access to the camera and the microphone. The page connects to the demo server and sends the video to the server. If connection and broadcasting of the video are successful, PUBLISHING is displayed.

webrtc-rtmp-republishing-chrome-testing

In the RTMP Target Details section we configure these two parameters of the RTMP stream:

  1. RTMP URL – address of the RTMP server
  2. Stream – the name of the video stream

 

By default, the RTMP URL is localhost. This means the WebRTC video stream will be redirected as RTMP to the same server.

At the right, there is a simple RTMP player (Adobe Flash Player, SWF). We use this player to test how the republished RTMP stream plays.

The address to play is automatically set to:
rtmp://wcs5-eu.flashphoner.com:1935/live/rtmp_38f9

The server automatically adds the rtmp_ prefix to the name of the video stream. Click Play to start playing video.

webrtc-rtmp-republish-working-demo-testing

As a result, the video stream is sent using WebRTC to the server and is republished on the same server as RTMP. We can make sure of it by playing the stream in our test RTMP player.

 

Testing WebRTC-RTMP republishing
to the YouTube Live service

For this test, you need to install WCS on your hosting, because the test requires you to modify one of configuration files of the server to make republishing work with YouTube. The installation process is described here: https://flashphoner.com/download

To test YouTube Live broadcasting, we need two things:

  1. Find out RTMP URL and Stream name.
  2. Configure WCS so that it would not add the rtmp_ prefix.

 

To learn parameters of the RTMP stream, open YouTube Live at: https://www.youtube.com/live_dashboard

RTMP settings are located in the Encoder Setup section:

youtube-live-webrtc-publish-as-rtmp-test

If you click Reveal, the name of the stream is shown, so you can copy it.

The screenshot below shows how fields in Youtube Live and the ‘WebRTC as RTMP re-publishing’ demo example match up to each other.

In particular:

Server URL == RTMP URL
Stream name/key == Stream

That is, we should insert Server URL from YouTube to the RTMP URL field of the example, and the revealed Stream name/key to the Stream field.

webrtc-as-rtmp-stream-details-name-rtmp-url

The name of the stream must exactly match the name specified in Stream name/key on YouTube. That is why we should turn off adding of the rtmp_ prefix by the server. To do this, open this file for editing:
/usr/local/FlashphonerWebCallServer/conf/flashphoner.properties

Then, comment out the following line:
rtmp_transponder_stream_name_prefix =rtmp_

Then, restart the server using this command:
service webcallserver restart

After restart, the server will not add its prefix, so everything should work now, and the stream will be sent to YouTube Live. The built-in RTMP player is not used in this case, because we play the stream directly from YouTube.

webrtc-as-rtmp-republishing-working-demo-youtube-live

On YouTube, after a few seconds you should see the picture and a green LIVE indicator that displays the current status of the stream.

youtube-live-broadcsting-in-action-from-webrtc

In conclusion, we have tested two variants of broadcasting:

  • Republishing a WebRTC stream as RTMP on the same server (localhost)
  • Republishing a WebRTC stream as RTMP on YouTube Live

 

The next step would be embedding the broadcasting script to the web page. The detailed instruction on how to do this can be found in the Embedding section.

 

Related articles

Oh, latency, thou art a heartless bitch

Broadcast video stream from web page to Facebook and YouTube simultaneously

Deployment multiplayer webrtc technology broadcast with a web camera via server in 3 minutes

 

Related features

Video broadcasting from the web camera of a browser or mobile device