facebook-live-embed-php icon indicating copy to clipboard operation
facebook-live-embed-php copied to clipboard

Any chance we can get this fixed ?

Open KJThaDon opened this issue 3 years ago • 11 comments

Any chance we can get this fixed ?

KJThaDon avatar Sep 05 '22 20:09 KJThaDon

@KJThaDon It’s been quite a while and Facebook has changed a ton so it have require starting from scratch, however, I might not be opposed to trying.

What’s your use case right now?

ThatGuySam avatar Sep 05 '22 22:09 ThatGuySam

@KJThaDon It’s been quite a while and Facebook has changed a ton so it have require starting from scratch, however, I might not be opposed to trying.

What’s your use case right now?

I am looking to have a permanent embed on a website front page. If there is a live stream going from a specific FB page, display it, if not maybe display an offline image or past broadcasts below it. The most important thing right now for me is to be able to have it pull the feed without having to change the embed code every new stream.

I appreciate the response! Been a headache trying to find a way to do this, when I feel like it should be a default embed option from FB.

Thank you

KJThaDon avatar Sep 05 '22 22:09 KJThaDon

It doesn’t display any offline message, however, the following seems to display currently live video for the page and the most recently live otherwise.

<!-- For https://www.facebook.com/Fb.gameover.here/ -->
<iframe
  src="https://www.facebook.com/plugins/video.php?href=https://www.facebook.com/Fb.gameover.here/live"
  frameborder="0"
  scrolling="no"
  allowfullscreen="true"
  height="1000px"
  width="100%"
>
</iframe>

Here’s a demo you can try out https://jsfiddle.net/jgbkhcpx/2/

Looks like it’s not documented by facebook but I found it here: https://stackoverflow.com/a/64256497

ThatGuySam avatar Sep 06 '22 01:09 ThatGuySam

It doesn’t display any offline message, however, the following seems to display currently live video for the page and the most recently live otherwise.

<!-- For https://www.facebook.com/Fb.gameover.here/ -->
<iframe
  src="https://www.facebook.com/plugins/video.php?href=https://www.facebook.com/Fb.gameover.here/live"
  frameborder="0"
  scrolling="no"
  allowfullscreen="true"
  height="1000px"
  width="100%"
>
</iframe>

Here’s a demo you can try out https://jsfiddle.net/jgbkhcpx/2/

Looks like it’s not documented by facebook but I found it here: https://stackoverflow.com/a/64256497

wow, I can't tell you how hard I've looked for a simple code like that lol

Thank you, I can work with this!

KJThaDon avatar Sep 06 '22 18:09 KJThaDon

However, for some reason when testing it with other pages doesn't seem to be working. Just tried a handful and I am just getting.

"Video Unavailable This video may no longer exist, or you don't have permission to view it. "

KJThaDon avatar Sep 06 '22 18:09 KJThaDon

Can you provide the code sample or page you're trying to use?

ThatGuySam avatar Sep 06 '22 18:09 ThatGuySam

Example: Live right now

<iframe
  src="https://www.facebook.com/plugins/video.php?href=https://www.facebook.com/TheTrueHitman/live"
  frameborder="0"
  scrolling="no"
  allowfullscreen="true"
  height="1000px"
  width="100%"
>
</iframe>

Default Facebook embed code (working fine on same stream) <iframe src="https://www.facebook.com/plugins/video.php?height=314&href=https%3A%2F%2Fwww.facebook.com%2FTheTrueHitman%2Fvideos%2F1479500709215605%2F&show_text=false&width=560&t=0" width="560" height="314" style="border:none;overflow:hidden" scrolling="no" frameborder="0" allowfullscreen="true" allow="autoplay; clipboard-write; encrypted-media; picture-in-picture; web-share" allowFullScreen="true"></iframe>

KJThaDon avatar Sep 06 '22 18:09 KJThaDon

It looks like it breaks when the URL redirects for a not-logged-in device.

https://www.facebook.com/TheTrueHitman/live
Redirects to: 
https://www.facebook.com/TheTrueHitman/videos/1479500709215605/
https://www.facebook.com/Fb.gameover.here/live
No redirect

You may be able to fix this for your particular Facebook Page if you can figure out how https://www.facebook.com/Fb.gameover.here/live sets up their page not to redirect when viewed from an Incognito browser.

ThatGuySam avatar Sep 06 '22 18:09 ThatGuySam

Ok, I think I may see why now. It looks like the page I posted vs the one you did, does not have the "live" tab showing (when accessed from a non logged in browser) in their Facebook page settings.

https://www.facebook.com/TheTrueHitman/ vs https://www.facebook.com/Fb.gameover.here/

In my case, this shouldn't be an issue since I can edit the page I am looking to embed. If anyone needs to know where to show the live tab, you can do so here

https://www.facebook.com/YOURPAGENAME/settings/?tab=edit_page

I'll have to test it for sure once we are live again, but thank you for the help!

KJThaDon avatar Sep 06 '22 19:09 KJThaDon

I may be able to write a script that can solve this automatically.

If I do, I'll update this repo with the script and a method for using it.

ThatGuySam avatar Sep 06 '22 19:09 ThatGuySam

I may be able to write a script that can solve this automatically.

If I do, I'll update this repo with the script and a method for using it.

I appreciate that very much!

KJThaDon avatar Sep 06 '22 19:09 KJThaDon