facebookfacebook-graph-apivlclibvlcrtmps

Facebook Graph API: cannot playback live video stream (rtmps)


I'm trying to playback a live video that is streamed using the Facebook app. When I hit the /me/live_videos endpoint in the Graph API Explorer, I can see my stream:

{
      "status": "LIVE",
      "stream_url": "rtmps://rtmp.facebook.com:443/rtmp/1659765194096063?ds=1&s_efg=eyJxZV9ncm91cHMiOnsiZmJsaXZlX3NlcnZlcl9leHBlcmltZW50Ijp7InNlcnZpY2VfcG9ydCI6IjE3MDAwIn19fQ%3D%3D&a=ATiAO7IBgkxJpDTS",
      "secure_stream_url": "rtmps://rtmp.facebook.com:443/rtmp/1659765194096063?ds=1&s_efg=eyJxZV9ncm91cHMiOnsiZmJsaXZlX3NlcnZlcl9leHBlcmltZW50Ijp7InNlcnZpY2VfcG9ydCI6IjE3MDAwIn19fQ%3D%3D&a=ATiAO7IBgkxJpDTS",
      "embed_html": "<iframe src=\"https://www.facebook.com/plugins/video.php?href=https%3A%2F%2Fwww.facebook.com%2Fjonathan.apphus%2Fvideos%2F1659765184096064%2F&width=360\" width=\"360\" height=\"640\" style=\"border:none;overflow:hidden\" scrolling=\"no\" frameborder=\"0\" allowTransparency=\"true\" allowFullScreen=\"true\"></iframe>",
      "id": "1659765194096063"
}

The stream is set to public, so anyone from within or outside of Facebook should be able to view it. My problem is that I am not able to view the stream using the "stream_url" (or "secure_stream_url"). I am trying to view it using VLC (have tried both the desktop app and the VLCKit lib on iOS).

Btw, the https link from the iframe works. I am able to view the stream in the browser using this link.

Error on VLC


Solution

  • The stream_url returned is only for forwarding the encoded video stream, not for receiving.

    If you want to view the live video, use dash_preview_url field of the live video.

    You can use graph api to get this url by sending a GET request at this end point:

    /LIVE_ID?fields=dash_preview_url&access_token=YourAccessToken
    

    This will return a url which can be played using any Dash Player. As far as I know, VLC currently does not have support for MPEG-DASH.