Ant Media Server can republish live streams to 3. party endpoints. In other words, live stream can be sent to Youtube, Facebook, Periscope and generic RTMP server simultaneously through Ant Media Server.

In this blog post, we are going to show how a developer can use this functionality on Ant Media Server.

Let’s do it on step by step fashinon

How to create client id and secret on the social platforms?

If you just want to test this functionality, please send an email  to to get test client id and client secret. If you develop your app, please follow the tutorial. Btw, Facebook and Youtube publishing features are on Enterprise Edition, Periscope publishing is on Community Edition.

  • Facebook: You need to create an app on Facebook Developers. After you create an app, you can use App ID as client id and and App Secret as client secret as shown below.
    Ant Media facebook ap

Btw, your app need to have publish_actions permission and Live Video API feature

  • Youtube: You need to create a project on Google Developers Console. You can learn details from Getting Started guide for Youtube API.
    In short

    • Enable Youtube Data API v3 on the project
    • Go to Credentials , click “Create Credentials”, a popup appears then choose “OAuth Cliend Id”
    • Select “Other” as application type and click the “Create” button then client id and client secret should appear in a dialog.

Ant media server youtube streamingYou can see client id and client secret whenever you click the item in the list shown above.

  • Periscope: Firstly, you need to apply the Periscope Producer API private beta program. After you join the program, just login to periscope and click your profile photo on top right. Then select the “Developer” item.
    How to Broadcast to Facebook

After that just click the “Add Application” then client id and client secret will be displayed on the page

How to configure app for publishing Facebook, Youtube and Periscope?

  • Open file in under apps WEB-INF folder and add the below properties to that file
  • Open red5-web.xml file again in under WEB-INF folder and make sure that web.handler bean is like below
    <bean id="web.handler" class="io.antmedia.serverapp.pscp.Application" >
     <property name="videoServiceEndpoints">
       <!-- Open this comment block if you use enterprise edition
       <bean class="" init-method="start">
         <constructor-arg value="${facebook.clientId}"/>
         <constructor-arg value="${facebook.clientSecret}"/>
         <constructor-arg ref=""/>
        <bean class="" init-method="start">
          <constructor-arg value="${periscope.clientId}"/>
          <constructor-arg value="${periscope.clientSecret}"/>
          <constructor-arg ref=""/>
        <!-- Open this comment block if you use enterprise edition
        <bean class="" init-method="start">
          <constructor-arg value="${youtube.clientId}"/>
          <constructor-arg value="${youtube.clientSecret}"/>
          <constructor-arg ref=""/>
     <property name="dataStore" ref="db.datastore" />


How to authenticate for Facebook, Youtube and Periscope?

Authenticate server to let it publish live stream on your behalf. In order to do that call below rest service with POST command


Change {serviceName} with facebook, youtube or periscope. This service returns a JSON data which includes verification_url and user_code. Please go to verification_url  value and enter the user_code value. A few seconds later you enter user_code , server will be authenticated for that service.

You can also call below rest service to look at whether server is authenticated


Again change {serviceName} with facebook, youtube or periscope.

How to Create a live stream with Social Endpoints?


with POST command and send Broadcast JSON object. Like below

   name:"live stream with social endpoints"

This rest service returns a Broadcast object with having and id field.

  • Then call below rest service with that id and social network name

This rest service consumes “application/x-www-form-urlencoded” format and requires “id” and “serviceName” fields.

How to start Publishing Live Stream?

Start publishing live stream to the server with the URL below


Please replace values accordingly and use stream’s “id”  for the “ID” in the URL. This “id” value is the one being returned by server in above section.

Then check the social media account to see the live stream.

Please let us know if you have any question by sending e-mail

Categories: Tutorial