[SOLVED] Play videos inside FaceBook?

MikeLFD

Joined: 2013-03-22
Posts: 79
Posted: Thu, 2013-08-29 19:15

I have the proper SSL certificates installed and my gallery 3 is connected via https.
How can I get my videos to play inside FaceBook when I share them and not my original Gallery site.
I used the FB debugger to check and all is in order there.

 
tempg

Joined: 2005-12-17
Posts: 1857
Posted: Thu, 2013-08-29 19:38

Social media embeds always require something extra. A quick search engine search gives what you're looking for. (This is not a Gallery thing; it's a Facebook thing.)

I've never actually done this, so your mileage may vary:
- http://www.longtailvideo.com/blog/19150/publish-your-videos-to-facebook-with-a-jw-player/
- http://stackoverflow.com/questions/4591764/how-to-embed-my-own-video-player-in-facebook

 
MikeLFD

Joined: 2013-03-22
Posts: 79
Posted: Thu, 2013-08-29 23:45

Let me be a little more specific.
I have all the proper meta tags (but 1) as verified by the FaceBook Debugger.

<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
  <? if ($theme->item() ) { ?>
<meta property="og:image" content="<?= $theme->item->thumb_url(true)?>"/ >    
  <meta property="og:title" content="<?=  $theme->item()->title ?>" />
  <meta property="og:description"content="<?= $theme->item()->description ?> " />
  <meta property="og:url" content="<?= $theme->item->abs_url() ?>" />
<meta property="og:video:type" content="application/x-shockwave-flash">
    <meta property="og:video:width" content="398">
    <meta property="og:video:height" content="224">

What's now missing when the link is shared is the video. I get the player box but the video itself isn't loaded.
Looking over the above I believe I need a tag to call the video itself just like the thumb is being called.
Question is what is the statement that will do it. For the thumb we use thumb_url(true)
What would it be for the video?
I believe the proper tag would be the same as the thumb meta but contain the video data. I've tried
<meta property="og:video" content="<?= $theme->item->video_url(true)?>"/ >
but that just causes an error.
Any ideas or suggestions?

 
MikeLFD

Joined: 2013-03-22
Posts: 79
Posted: Fri, 2013-08-30 00:07

We are getting closer to the answer.
When I use: <meta property="og:video" content="<?= $theme->item->file_url(true) ?>"/ >
I get the file necessary: Party.mp4?m=1370413294
How can I strip the ?m=1370413294

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Fri, 2013-08-30 02:14

The new slideshow module, I'm including video in an iframe like youtube and the rest. My method may be what FB needs.

-s
________________________________
All New jQuery Minislideshow for G2/G3

 
MikeLFD

Joined: 2013-03-22
Posts: 79
Posted: Fri, 2013-08-30 02:20

One change that I can't seem to put my finger on and it'll work with the meta tags.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Sat, 2013-08-31 15:08
Quote:
How can I strip the ?m=1370413294

With some regex I would think would be a good option.
or try:
$url = strtok($url, '?');
I think it should return everything up to the ? and remove everything else.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
tempg

Joined: 2005-12-17
Posts: 1857
Posted: Sat, 2013-08-31 15:49

1st: I'm a super fan of @suprsidr's work!!

2nd: @floridave: Oooh: $url = strtok($url, '?');; I've got to try that. Learn something new every day!

3rd: @MikeLFD: You can also try $url = preg_split('?m',$url,0,PREG_SPLIT_NO_EMPTY);

(I'm not sure if the '?' needs to be escaped here; I don't it does, but I haven't tested, so if @floridave's solution doesn't work an the code I put there doesn't work, try escaping it.)

EDIT: @MikeLFD: Out of curiosity: Was the "?m=1370413294" causing a problem, or do you just not like the way it looks? I don't see why it would be an issue for the code you need. Again, just curious here.

 
MikeLFD

Joined: 2013-03-22
Posts: 79
Posted: Sat, 2013-08-31 21:32

Temp,
It's causing the video not to load inside Facebook.
The player shows but the video won't load. The ?m stuff conflicts with the meta tag some how when it looks for the mp4 to load and play.

 
MikeLFD

Joined: 2013-03-22
Posts: 79
Posted: Sun, 2013-09-01 12:19

Temp and Dave,
I'm guessing this code doesn't go in the meta tag. Least it doesn't the way I tried entering it

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Sun, 2013-09-01 14:41
<?php
$url = $theme->item->video_url(true);
$url = strtok($url, '?');
?>
<meta property="og:video" content="<?= $url ?>"/ >

Does that work?

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
MikeLFD

Joined: 2013-03-22
Posts: 79
Posted: Sun, 2013-09-01 15:17

Nope it crashes the website

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Sun, 2013-09-01 15:29
<? if ($theme->item()->is_movie()) {   
$url = $theme->item->file_url(true);
$url = strtok($url, '?');
?>
<meta property="og:video" content="<?= $url ?>"/ >
<? } ?>

you confused me with the video_url function

I bet you are going to have to wrap it up in more if checks to see if the item is a move as well or it might not work on photo or album pages.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Sun, 2013-09-01 15:33

Are we reinventing the wheel here?
http://codex.galleryproject.org/Gallery3:Modules:ogp_tags

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
MikeLFD

Joined: 2013-03-22
Posts: 79
Posted: Sun, 2013-09-01 15:51

That last code you posted was it. Thank you.

I have no idea if we are re-inventing the wheel.
The ogp_tags module doesn't have a download option to it, hence this thread

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Sun, 2013-09-01 17:32

Yes it does from http://www.gallerymodules.com/

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Sun, 2013-09-01 17:36

Looking at http://fb.stevelarsen.co.uk/example.html it also allows form url query parameters so don't know if you need to sanitize the parameter or not.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team