2016年6月6日星期一

[Go live with Facebook Live API] Step 2: Create a live video and stream it

After previous blog, I believe you already have your app ready with the right permission setting.

There are two ways to create a live video in facebook. Let's go through an example here. I want to create a live video on my profile timeline.


     Note, in the url,  I use /me/ to represent myself. If you want to create a live video on a page/group/event, you need to use page/group/event id here.
  • user command line 
 curl -k -X POST https://graph.facebook.com/$your_userid_or_pageid/live_videos  
 -F "access_token=$your_user_or_page_token"  


And you will receive the stream_url as the rtmp ingestion endpoint for your encoder, for example:
     rtmp url        rtmp://rtmp-dev.facebook.com:80/rtmp/ (http://rtmp-dev.facebook.com/rtmp/)  
     key           10207831706528497?a=Adoap6R3g0o3Jd96o4k   


With this ingestion url, you can use any 3rd part encoder to stream the content. If this is your first time broadcasting, please install this software (https://obsproject.com/download#mac) and follow the guide here: https://www.youtube.com/watch?v=23RErS0H9gY

Make sure you input the steam_url and key in the right format as below:


Click the "Start Streaming" button, and switch to your facebook. You will see a similar post as below



















没有评论:

发表评论