Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Facebook embed not working #18

Closed
411x opened this issue Mar 19, 2017 · 7 comments
Closed

Facebook embed not working #18

411x opened this issue Mar 19, 2017 · 7 comments
Labels

Comments

@411x
Copy link

411x commented Mar 19, 2017

Message in the FB player :

href should represent a valid URL

function getEmbed( $id, $host ) {  

        $MediaEmbed = new MediaEmbed();  

        $MediaObject = $MediaEmbed->parseId($id, $host);  

        if (!$MediaObject) {  
            return '';  
        }  
        return $MediaObject->getEmbedCode();  
}

I call the function this way
getEmbed($embed->id(), $embed->slug());

(and I checked, the slug and id are good)

And this is the embed code I got

<iframe src="https://www.facebook.com/plugins/video.php?href=$1&show_text=0&amp;wmode=transparent" type="" width="480" height="295" frameborder="0" allowfullscreen class="embed-responsive-item" data-html5-parameter></iframe>

MediaEmbed->parseUrl is working without a problem with facebook.

@dereuromark
Copy link
Owner

So what is your expectation here? Do you know a fix?

@411x
Copy link
Author

411x commented Mar 20, 2017

I naively expected to have a working player that works with just "facebook" and the id.
But i get it, you can't constuct the entire "href" url with only these two elements. We need the profile slug also..

I have two dirty cheap fix (the second one seems the better):

  1. replace in stubs.php

'iframe-player' => 'https://www.facebook.com/plugins/video.php?href=$1&show_text=0',

by

'iframe-player' => 'https://www.facebook.com/video/embed?video_id=$2',

but.. this url (working to this day) is deprecated..
https://developers.facebook.com/docs/plugins/embedded-video-player#faq

If you use the embed_html property's value, your video player will:

  • Not work on mobile devices and tablets
  • Not contain any additional information like views, video title, etc.
  1. replace the unknown profile slug by "facebook" and it's working perfectly (like, share & co) as if it was
    the real profile slug.

'iframe-player' => 'https://www.facebook.com/plugins/video.php?href=https%3A%2F%2Fwww.facebook.com%2Ffacebook%2Fvideos%2F$2%2F&show_text=0',

So, my fix to this day is the second one.

@dereuromark
Copy link
Owner

Can you please make a PR with the suggest fix?

@dereuromark
Copy link
Owner

Can you confirm that #20 resolves this?

@dereuromark dereuromark added the bug label Aug 3, 2017
@Erwane
Copy link
Contributor

Erwane commented Nov 4, 2017

merge #23 solve that. Could you bump the version please ?

Thanks.

@dereuromark
Copy link
Owner

I dont quite get why we changed it to $2, and now back to $1.

'https://www.facebook.com/[0-9a-z-_.]+/videos/([0-9]+)/',
'https://www.facebook.com/[0-9a-zA-Z-_.]+/videos/(?:vb.\d+)/(\d+)/',
'https://www.facebook.com/[0-9a-zA-Z-_.]+/videos/(?:vl.\d+)/(\d+)/'

Are all 3 still working?

@Erwane
Copy link
Contributor

Erwane commented Feb 8, 2018

Yes it's working (in november).
Because Facebook require the full url now, not only the video Id

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants