Facebook Live playback

howto

#1

Question is simple: How can I playback a Facebook Live stream?

The local City Council will do its annual Public Account next week and we were requested to relay its Facebook Live stream of the event at out local station. I know that YouTube Live streams can be played using the embedded player with autoplay, but I don’t know if Facebook Live offers the same or another kind of API.


#2

This may be a decent place to start if you haven’t already found it :slight_smile:


#3

I didn’t know about this page, thanks for the lead. :+1:

Anyway, after testing a couple of things, I hit a dead end after a short journey. First, just as with YouTube, you can play a fullscreen embed with an url, unmuted as well.

But my problem happened when I tried doing a PLAY 1-1 [HTML] "<url>", because I got errors and ultimately no playback. In my console this showed up:

[2020-04-25 23:51:48.553] [1128]  [info]    Received message from Console: play 1-1 [html] "https://www.facebook.com/v6.0/plugins/video.php?app_id=113869198637480&channel=https%3A%2F%2Fstaticxx.facebook.com%2Fconnect%2Fxd_arbiter.php%3Fversion%3D46%23cb%3Df29b7c16b3a7d68%26domain%3Ddevelopers.facebook.com%26origin%3Dhttps%253A%252F%252Fdevelopers.facebook.com%252Ff38998eea8b8398%26relation%3Dparent.parent&container_width=734&href=https%3A%2F%2Fwww.facebook.com%2Fdjpeligroperu%2Fvideos%2F591580238373576%2F%3Fv%3D591580238373576&locale=es_LA&sdk=joey&show_text=false&autoplay=1&mute=0"\r\n
[2020-04-25 23:51:48.555] [1260]  [info]    transition[empty=>html[https://www.facebook.com/v6.0/plugins/video.php?app_id=113869198637480&channel=https%3A%2F%2Fstaticxx.facebook.com%2Fconnect%2Fxd_arbiter.php%3Fversion%3D46%23cb%3Df29b7c16b3a7d68%26domain%3Ddevelopers.facebook.com%26origin%3Dhttps%253A%252F%252Fdevelopers.facebook.com%252Ff38998eea8b8398%26relation%3Dparent.parent&container_width=734&href=https%3A%2F%2Fwww.facebook.com%2Fdjpeligroperu%2Fvideos%2F591580238373576%2F%3Fv%3D591580238373576&locale=es_LA&sdk=joey&show_text=false&autoplay=1&mute=0]] Initialized
#202 PLAY OK

[2020-04-25 23:51:51.989] [13636] [info]    html[https://www.facebook.com/v6.0/plugins/video.php?app_id=113869198637480&channel=https%3A%2F%2Fstaticxx.facebook.com%2Fconnect%2Fxd_arbiter.php%3Fversion%3D46%23cb%3Df29b7c16b3a7d68%26domain%3Ddevelopers.facebook.com%26origin%3Dhttps%253A%252F%252Fdevelopers.facebook.com%252Ff38998eea8b8398%26relation%3Dparent.parent&container_width=734&href=https%3A%2F%2Fwww.facebook.com%2Fdjpeligroperu%2Fvideos%2F591580238373576%2F%3Fv%3D591580238373576&locale=es_LA&sdk=joey&show_text=false&autoplay=1&mute=0] Log: Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://developers.facebook.com') does not match the recipient window's origin ('https://www.facebook.com').
[2020-04-25 23:51:51.989] [13636] [info]    html[https://www.facebook.com/v6.0/plugins/video.php?app_id=113869198637480&channel=https%3A%2F%2Fstaticxx.facebook.com%2Fconnect%2Fxd_arbiter.php%3Fversion%3D46%23cb%3Df29b7c16b3a7d68%26domain%3Ddevelopers.facebook.com%26origin%3Dhttps%253A%252F%252Fdevelopers.facebook.com%252Ff38998eea8b8398%26relation%3Dparent.parent&container_width=734&href=https%3A%2F%2Fwww.facebook.com%2Fdjpeligroperu%2Fvideos%2F591580238373576%2F%3Fv%3D591580238373576&locale=es_LA&sdk=joey&show_text=false&autoplay=1&mute=0] Log: Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://developers.facebook.com') does not match the recipient window's origin ('https://www.facebook.com').
[2020-04-25 23:51:54.150] [13636] [info]    html[https://www.facebook.com/v6.0/plugins/video.php?app_id=113869198637480&channel=https%3A%2F%2Fstaticxx.facebook.com%2Fconnect%2Fxd_arbiter.php%3Fversion%3D46%23cb%3Df29b7c16b3a7d68%26domain%3Ddevelopers.facebook.com%26origin%3Dhttps%253A%252F%252Fdevelopers.facebook.com%252Ff38998eea8b8398%26relation%3Dparent.parent&container_width=734&href=https%3A%2F%2Fwww.facebook.com%2Fdjpeligroperu%2Fvideos%2F591580238373576%2F%3Fv%3D591580238373576&locale=es_LA&sdk=joey&show_text=false&autoplay=1&mute=0] Log: Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://developers.facebook.com') does not match the recipient window's origin ('https://www.facebook.com').
[2020-04-25 23:51:54.172] [13636] [info]    html[https://www.facebook.com/v6.0/plugins/video.php?app_id=113869198637480&channel=https%3A%2F%2Fstaticxx.facebook.com%2Fconnect%2Fxd_arbiter.php%3Fversion%3D46%23cb%3Df29b7c16b3a7d68%26domain%3Ddevelopers.facebook.com%26origin%3Dhttps%253A%252F%252Fdevelopers.facebook.com%252Ff38998eea8b8398%26relation%3Dparent.parent&container_width=734&href=https%3A%2F%2Fwww.facebook.com%2Fdjpeligroperu%2Fvideos%2F591580238373576%2F%3Fv%3D591580238373576&locale=es_LA&sdk=joey&show_text=false&autoplay=1&mute=0] Log: Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://developers.facebook.com') does not match the recipient window's origin ('https://www.facebook.com').
[2020-04-25 23:51:54.173] [13636] [info]    html[https://www.facebook.com/v6.0/plugins/video.php?app_id=113869198637480&channel=https%3A%2F%2Fstaticxx.facebook.com%2Fconnect%2Fxd_arbiter.php%3Fversion%3D46%23cb%3Df29b7c16b3a7d68%26domain%3Ddevelopers.facebook.com%26origin%3Dhttps%253A%252F%252Fdevelopers.facebook.com%252Ff38998eea8b8398%26relation%3Dparent.parent&container_width=734&href=https%3A%2F%2Fwww.facebook.com%2Fdjpeligroperu%2Fvideos%2F591580238373576%2F%3Fv%3D591580238373576&locale=es_LA&sdk=joey&show_text=false&autoplay=1&mute=0] Log: Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://developers.facebook.com') does not match the recipient window's origin ('https://www.facebook.com').
[2020-04-25 23:51:54.332] [13636] [info]    html[https://www.facebook.com/v6.0/plugins/video.php?app_id=113869198637480&channel=https%3A%2F%2Fstaticxx.facebook.com%2Fconnect%2Fxd_arbiter.php%3Fversion%3D46%23cb%3Df29b7c16b3a7d68%26domain%3Ddevelopers.facebook.com%26origin%3Dhttps%253A%252F%252Fdevelopers.facebook.com%252Ff38998eea8b8398%26relation%3Dparent.parent&container_width=734&href=https%3A%2F%2Fwww.facebook.com%2Fdjpeligroperu%2Fvideos%2F591580238373576%2F%3Fv%3D591580238373576&locale=es_LA&sdk=joey&show_text=false&autoplay=1&mute=0] Log: ErrorUtils caught an error:
[2020-04-25 23:51:54.332] [13636] [info]    
[2020-04-25 23:51:54.332] [13636] [info]    Failed to execute 'addSourceBuffer' on 'MediaSource': The type provided ('video/mp4; codecs="avc1.4d401e"') is unsupported.
[2020-04-25 23:51:54.332] [13636] [info]    
[2020-04-25 23:51:54.332] [13636] [info]    Subsequent errors won't be logged; see https://fburl.com/debugjs.

Doing some searches, apparently this is related with the CEF version (3.3239.1705 in 2.1.10 NRK) but I’m not so sure about it. Probably @Julusian could shed some light on this.

Now, so far, I reached a workaround through 2 ways which involve NDI:

  1. Capturing a browser window with NDI Scan Converter.
  2. Running OBS with OBS NDI plugin, open the embed link with OBS internal browser and output OBS over NDI.

It’s a bit convoluted, but it does the job. If there’s a simpler/shorter way, I’d be thrilled to know.


#4

No need to run the scan converter-casparcg can be setup to output ndi which can then be a direct input source for obs edit the channel config file to add it in.

Guide here on setup it up:
CasparCG channel Ndi output


#5

The solution you are proposing is the opposite direction. I understand the goal is to ingest facebook live videos into CasparCG.

I think Scan Converter or OBS (Decklink also) are the only solutions for the moment.
CasparCG’s HTML producer lacks MP4/H.264 codec support so live videos on facebook or youtube are not possible as they use HLS and it mainly relies on them.


#6

I hadn’t tested YouTube Live and sure thing, it didn’t work as well.

As far as I can tell, it only supports VP9 codec, so it can’t play anything H.264/H.265 in it, because CEF requires special flags to be compiled with before integration with CasparCG.

A good lead into it, indeed. The OBS solution I described is quite functional for my purposes, it has a minimal memory footprint, and it doesn’t need any additional computers or cabling and format conformity.

Thanks for the help.


#7

Yeah, so the publicly available builds of CEF are built without support for h264 playback.
We could include a version of CEF with that flag enabled, but that will require me to spend some time getting a CEF build environment setup (I have done this before, but builds take hours to complete), and it needs us to figure out where to store the binaries to allow them to be included easily.


#8

Would be nice if you could make that possible.