[ Video Sharing CMS v4 ] Facebook & Twitter Player Video Embed

Started by dargpat,

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

dargpatTopic starter

I know for twitter to work it has to be approved but when I was using 3.1 I got it to work.  Now in 3.3 I'm trying to figure out how call the information needed.  Not sure if this is the best way but here is what I am doing:

I'm adding this code to tpl.globals.php under the meta_add() funtion:  Here is what I have so far:
    <meta property="og:video" content="URL/TO/PLAYER.SWF?file=SOURCE">
    <meta property="og:video:type" content="application/x-shockwave-flash">
    <meta property="og:video:width" content="1920">
    <meta property="og:video:height" content="1080">

    <meta property="fb:app_id" content="FACEBOOKAPPID">

    <meta property="og:site_name" content="SITENAME/DOMAIN">
    <meta property="og:video:secure_url" content="SEC_URL/TO/PLAYER.SWF?file=SOURCE">
    <meta property="og:url" content="'.$canonical.'">
    <meta property="og:title" content="'.seo_title().'">
    <meta property="og:type" content="video">
    <meta property="og:image" content="'URLTOTHUMB">
    <meta property="og:description" content="'.seo_desc().'">


    <meta name="twitter:card" content="player">
    <meta name="twitter:site" content="@TWITTERNAME">
    <meta name="twitter:creator" content="@TWITTERNAME">
    <meta name="twitter:title" content="'.seo_title().'">
    <meta name="twitter:description" content="'.seo_desc().'">
    <meta name="twitter:image:src" content="URLTOTHUMB">
    <meta name="twitter:player" content="SEC_URL/TO/PLAYER.SWF">
    <meta name="twitter:player:stream" content="SOURCE">
    <meta name="twitter:player:stream:content_type" content="application/x-shockwave-flash">
    <meta name="twitter:player:height" content="1080">
    <meta name="twitter:player:width" content="1920">
    <meta name="twitter:domain" content="DOMAIN">
    <meta name="twitter:app:name:iphone" content="">
    <meta name="twitter:app:name:ipad" content="">
    <meta name="twitter:app:name:googleplay" content="">
    <meta name="twitter:app:url:iphone" content="">
    <meta name="twitter:app:url:ipad" content="">
    <meta name="twitter:app:url:googleplay" content="">
    <meta name="twitter:app:id:iphone" content="">
    <meta name="twitter:app:id:ipad" content="">
    <meta name="twitter:app:id:googleplay" content="">


How do I call info needed to produce (URLTOTHUMB & SOURCE from DB) so that I can add to tpl.globals.php

.. everything else I can manage!
  •  

Marius P.

global $video.

thumb_fix($video->thumb);
$video->source (you should check it with an if.
Happy with my help? Buy me a coffee.
Please, always use the search before opening a new topic! We're all here on our (limited) free time! Make sure you help yourself too!
  •  

dargpatTopic starter

So this is what I did:

I created a folder in root called jw5.  I moved contents from phpvibe3.1 folder /components/player/ to /jw5

Created a function and added it to the bottom of /lib/functions.php (Upload when done!)
function fb_tw_meta($token){
global $db,$canonical;
$video = $db->get_row("SELECT source,thumb from ".DB_PREFIX."videos where id='".toDb($token)."'");
   if($video){
        $site_url = site_url();
        $sec_site_url = str_replace("http", "https",site_url());
        $thumb = $video->thumb;
	$video_source = $video->source;
        $localfile = str_replace("localfile", "", $video_source);
        $host = str_replace("www.", "",$_SERVER['HTTP_HOST']);

        if (strpos($video_source,'localfile') !== false) { //local or external video

           $ext_vidurl= $site_url ."jw5/player.swf?file=".$site_url."media".$localfile."&autostart=false&logo.file=".$site_url."jw5/playerlogo.png&logo.link=".$canonical."&logo.hide=false&logo.position=bottom-left&stretching=";
           if(get_option('sec_swf_url')!==""){
              $ext_securl= get_option('sec_swf_url')."?file=".$site_url."media".$localfile."&autostart=false&logo.file=".$site_url."jw5/playerlogo.png&logo.link=".$canonical."&logo.hide=false&logo.position=bottom-left&stretching=";
              $twit_player = get_option('sec_swf_url');
           }else{
              $ext_securl= $sec_site_url."jw5/player.swf?file=".$site_url."media".$localfile."&autostart=false&logo.file=".$sec_site_url."jw5/playerlogo.png&logo.link=".$canonical."&logo.hide=false&logo.position=bottom-left&stretching=";
              $twit_player = $sec_site_url."jw5/player.swf";
           }
           $twit_vid = $site_url."media".$localfile;

           $thumburl = $site_url."".$thumb;

         }else{

           $ext_vidurl= $site_url ."jw5/player.swf?file=".$video_source."&autostart=false&logo.file=".$site_url."jw5/playerlogo.png&logo.link=".$canonical."&logo.hide=false&logo.position=bottom-left&stretching=";
           if(get_option('sec_swf_url')!==""){
              $ext_securl= get_option('sec_swf_url')."?file=".$video_source."&autostart=false&logo.file=".$site_url."jw5/playerlogo.png&logo.link=".$canonical."&logo.hide=false&logo.position=bottom-left&stretching=";
              $twit_player = get_option('sec_swf_url');
           }else{
              $ext_securl= $sec_site_url."jw5/player.swf?file=".$video_source."&autostart=false&logo.file=".$site_url."jw5/playerlogo.png&logo.link=".$canonical."&logo.hide=false&logo.position=bottom-left&stretching=";
              $twit_player = $sec_site_url."jw5/player.swf";
           }
           $twit_vid = $video_source;

           $thumburl = $thumb;

         }

         $data.='
    <!---- FACEBOOK/TWITTER META --------------------->
    <meta property="fb:app_id" content="'.Fb_Key.'">
    <meta property="og:video" content="'.$ext_vidurl.'">
    <meta property="og:video:type" content="application/x-shockwave-flash">
    <meta property="og:video:width" content="1920">
    <meta property="og:video:height" content="1080">
    <meta property="og:site_name" content="'.$host.'">
    <meta property="og:video:secure_url" content="'.$ext_securl.'">
    <meta property="og:url" content="'.$canonical.'">
    <meta property="og:title" content="['.$host.'] - '.seo_title().'">
    <meta property="og:type" content="video">
    <meta property="og:image" content="'.$thumburl.'">
    <meta property="og:description" content="'.seo_desc().'">

    <meta name="twitter:card" content="player">
    <meta name="twitter:site" content="@'.get_option('twit_sitename').'">
    <meta name="twitter:creator" content="@'.get_option('twit_creatorname').'">
    <meta name="twitter:title" content="['.$host.'] - '.seo_title().'">
    <meta name="twitter:description" content="'.seo_desc().'">
    <meta name="twitter:image:src" content="'.$thumburl.'">
    <meta name="twitter:player" content="'.$twit_player.'">
    <meta name="twitter:player:stream" content="'.$twit_vid.'">
    <meta name="twitter:player:stream:content_type" content="application/x-shockwave-flash">
    <meta name="twitter:player:height" content="1080">
    <meta name="twitter:player:width" content="1920">
    <meta name="twitter:domain" content="'.$host.'">

    <meta name="twitter:app:name:iphone" content="">
    <meta name="twitter:app:name:ipad" content="">
    <meta name="twitter:app:name:googleplay" content="">
    <meta name="twitter:app:url:iphone" content="">
    <meta name="twitter:app:url:ipad" content="">
    <meta name="twitter:app:url:googleplay" content="">
    <meta name="twitter:app:id:iphone" content="">
    <meta name="twitter:app:id:ipad" content="">
    <meta name="twitter:app:id:googleplay" content="">
    <!---------------- END META    ------------------->';

    return $data;

   } else{
      return null;
   }
}
?>


add this code to the function meta_add() (/tpl/main/tpl.globals.php) (Upload when done!)
'.fb_tw_meta(token_id()).'

after
<meta name="author" content="www.phpvibe.com">


go to your admin (TOOLS/OPTIONS API) and add these Options & Values:
OPTION -> twit_sitename	VALUE -> TWITTERNAME without '@'
OPTION -> twit_creatorname	VALUE -> TWITTERNAME without '@'
OPTION -> sec_swf_url	        VALUE -> URL to Secure SWF player ex: https://somesite.com/path/player.swf


If you leave URL to SWF blank, function will assume URL to secure player is your own domain: ex: https://yoursite.com/jw5/player.swf


I think thats it!  Now someone overlook my code and way of doing and tell me how I can improve on it!  Thanks!
  •  

ilie88

Quote from: dargpat on
So this is what I did:

I created a folder in root called jw5.  I moved contents from phpvibe3.1 folder /components/player/ to /jw5

Created a function and added it to the bottom of /lib/functions.php (Upload when done!)
function fb_tw_meta($token){
global $db,$canonical;
$video = $db->get_row("SELECT source,thumb from ".DB_PREFIX."videos where id='".toDb($token)."'");
   if($video){
        $site_url = site_url();
        $sec_site_url = str_replace("http", "https",site_url());
        $thumb = $video->thumb;
	$video_source = $video->source;
        $localfile = str_replace("localfile", "", $video_source);
        $host = str_replace("www.", "",$_SERVER['HTTP_HOST']);

        if (strpos($video_source,'localfile') !== false) { //local or external video

           $ext_vidurl= $site_url ."jw5/player.swf?file=".$site_url."media".$localfile."&autostart=false&logo.file=".$site_url."jw5/playerlogo.png&logo.link=".$canonical."&logo.hide=false&logo.position=bottom-left&stretching=";
           if(get_option('sec_swf_url')!==""){
              $ext_securl= get_option('sec_swf_url')."?file=".$site_url."media".$localfile."&autostart=false&logo.file=".$site_url."jw5/playerlogo.png&logo.link=".$canonical."&logo.hide=false&logo.position=bottom-left&stretching=";
              $twit_player = get_option('sec_swf_url');
           }else{
              $ext_securl= $sec_site_url."jw5/player.swf?file=".$site_url."media".$localfile."&autostart=false&logo.file=".$sec_site_url."jw5/playerlogo.png&logo.link=".$canonical."&logo.hide=false&logo.position=bottom-left&stretching=";
              $twit_player = $sec_site_url."jw5/player.swf";
           }
           $twit_vid = $site_url."media".$localfile;

           $thumburl = $site_url."".$thumb;

         }else{

           $ext_vidurl= $site_url ."jw5/player.swf?file=".$video_source."&autostart=false&logo.file=".$site_url."jw5/playerlogo.png&logo.link=".$canonical."&logo.hide=false&logo.position=bottom-left&stretching=";
           if(get_option('sec_swf_url')!==""){
              $ext_securl= get_option('sec_swf_url')."?file=".$video_source."&autostart=false&logo.file=".$site_url."jw5/playerlogo.png&logo.link=".$canonical."&logo.hide=false&logo.position=bottom-left&stretching=";
              $twit_player = get_option('sec_swf_url');
           }else{
              $ext_securl= $sec_site_url."jw5/player.swf?file=".$video_source."&autostart=false&logo.file=".$site_url."jw5/playerlogo.png&logo.link=".$canonical."&logo.hide=false&logo.position=bottom-left&stretching=";
              $twit_player = $sec_site_url."jw5/player.swf";
           }
           $twit_vid = $video_source;

           $thumburl = $thumb;

         }

         $data.='
    <!---- FACEBOOK/TWITTER META --------------------->
    <meta property="fb:app_id" content="'.Fb_Key.'">
    <meta property="og:video" content="'.$ext_vidurl.'">
    <meta property="og:video:type" content="application/x-shockwave-flash">
    <meta property="og:video:width" content="1920">
    <meta property="og:video:height" content="1080">
    <meta property="og:site_name" content="'.$host.'">
    <meta property="og:video:secure_url" content="'.$ext_securl.'">
    <meta property="og:url" content="'.$canonical.'">
    <meta property="og:title" content="['.$host.'] - '.seo_title().'">
    <meta property="og:type" content="video">
    <meta property="og:image" content="'.$thumburl.'">
    <meta property="og:description" content="'.seo_desc().'">

    <meta name="twitter:card" content="player">
    <meta name="twitter:site" content="@'.get_option('twit_sitename').'">
    <meta name="twitter:creator" content="@'.get_option('twit_creatorname').'">
    <meta name="twitter:title" content="['.$host.'] - '.seo_title().'">
    <meta name="twitter:description" content="'.seo_desc().'">
    <meta name="twitter:image:src" content="'.$thumburl.'">
    <meta name="twitter:player" content="'.$twit_player.'">
    <meta name="twitter:player:stream" content="'.$twit_vid.'">
    <meta name="twitter:player:stream:content_type" content="application/x-shockwave-flash">
    <meta name="twitter:player:height" content="1080">
    <meta name="twitter:player:width" content="1920">
    <meta name="twitter:domain" content="'.$host.'">

    <meta name="twitter:app:name:iphone" content="">
    <meta name="twitter:app:name:ipad" content="">
    <meta name="twitter:app:name:googleplay" content="">
    <meta name="twitter:app:url:iphone" content="">
    <meta name="twitter:app:url:ipad" content="">
    <meta name="twitter:app:url:googleplay" content="">
    <meta name="twitter:app:id:iphone" content="">
    <meta name="twitter:app:id:ipad" content="">
    <meta name="twitter:app:id:googleplay" content="">
    <!---------------- END META    ------------------->';

    return $data;

   } else{
      return null;
   }
}
?>


add this code to the function meta_add() (/tpl/main/tpl.globals.php) (Upload when done!)
'.fb_tw_meta(token_id()).'

after
<meta name="author" content="www.phpvibe.com">


go to your admin (TOOLS/OPTIONS API) and add these Options & Values:
OPTION -> twit_sitename	VALUE -> TWITTERNAME without '@'
OPTION -> twit_creatorname	VALUE -> TWITTERNAME without '@'
OPTION -> sec_swf_url	        VALUE -> URL to Secure SWF player ex: https://somesite.com/path/player.swf


If you leave URL to SWF blank, function will assume URL to secure player is your own domain: ex: https://yoursite.com/jw5/player.swf


I think thats it!  Now someone overlook my code and way of doing and tell me how I can improve on it!  Thanks!

I don't get the point what are you trying to do?
website: http://www.movietend.com  Don't PM me regarding news about the script's, I'm not from the stuff i am regular user like anyone else, Regards
  •  

dargpatTopic starter

Quote from: ilie88 on
I don't get the point what are you trying to do?

Look up embedding your own player into facebook & twitter post on their websites!

https://dev.twitter.com/docs/cards/validation/validator

I don't know a link for facebook!
  •  

Marius P.

I think that code is messy and unprofessional, I'll stop here :-X
Why?
You already have a $video, why re-assign so many variables and mess around the code?


if((com() == video) && $video && ( strpos($video_source,'localfile') !== false || !empty($video->remote))) {


// Now you know you are on the video page, you have available a video, and the video is either local video file, or remote video file


}




And I think it's pointless to try something I am already building, but as you please.
Happy with my help? Buy me a coffee.
Please, always use the search before opening a new topic! We're all here on our (limited) free time! Make sure you help yourself too!
  •  

dargpatTopic starter

Quote from: @Mario on
I think that code is messy and unprofessional, I'll stop here :-X
Why?
You already have a $video, why re-assign so many variables and mess around the code?


if((com() == video) && $video && ( strpos($video_source,'localfile') !== false || !empty($video->remote))) {


// Now you know you are on the video page, you have available a video, and the video is either local video file, or remote video file


}




And I think it's pointless to try something I am already building, but as you please.

Wow .. real professional response ... and i built it cuz you have not release anything on it!!!
  •  

ilie88

Quote from: dargpat on
Look up embedding your own player into facebook & twitter post on their websites!

https://dev.twitter.com/docs/cards/validation/validator

I don't know a link for facebook!

ooh now i got it, well i have bad news for you, on facebook it wont play unless you upload the video on your local server, about the twitter i don't know
website: http://www.movietend.com  Don't PM me regarding news about the script's, I'm not from the stuff i am regular user like anyone else, Regards
  •  

Marius P.

Quote from: dargpat on
Wow .. real professional response ... and i built it cuz you have not release anything on it!!!

darpat, let's get one thing straight: I am here for the sole purpose of helping you getting the script working.
I'm not here to show you how to build custom stuff, if I do this, I do it cause I am passionate about my work, theoretically I should not even mind a topic like this.
I have my priorities, and a list of build-up, I won't push one faster cause you think you need it.
For example in RC2 EVERY file is changed comparing to RC1, you will ask me to help, I will help, but my build will be different, you will just upgrade to my build in days => answering will be just lost time.
I hope you understand! I am not unprofessional, I am direct and honest, if that's unprofessional to you, ok, I can accept that. You run 80 lines of code instead of 10, it feels, at least a little bit, so i am trying to help you keep it clean, even if, once again, it's not on my "have to do list".
Happy with my help? Buy me a coffee.
Please, always use the search before opening a new topic! We're all here on our (limited) free time! Make sure you help yourself too!
  •  

dargpatTopic starter

Quote from: @Mario on
darpat, let's get one thing straight: I am here for the sole purpose of helping you getting the script working.
I'm not here to show you how to build custom stuff, if I do this, I do it cause I am passionate about my work, theoretically I should not even mind a topic like this.
I have my priorities, and a list of build-up, I won't push one faster cause you think you need it.
For example in RC2 EVERY file is changed comparing to RC1, you will ask me to help, I will help, but my build will be different, you will just upgrade to my build in days => answering will be just lost time.
I hope you understand! I am not unprofessional, I am direct and honest, if that's unprofessional to you, ok, I can accept that. You run 80 lines of code instead of 10, it feels, at least a little bit, so i am trying to help you keep it clean, even if, once again, it's not on my "have to do list".

First ... I didn't ask @MARIO directly!  I didn't ask @MARIO to push anything!  I simply asked a question to the forum members which you took upon yourself to answer.  A forum is a place to talk and share things and that is all I was doing.  I have no idea who all works on this script.  I've only read through a your script the past week or so, so I do not know all functions and variables I need or that are available.  Hence my reason for creating extra variables not needed, but to get done what I need .. also the reason I asked:

"Now someone overlook my code and way of doing and tell me how I can improve on it!  Thanks!"

I appreciate what you have done and the outcome of your work.  But to call someone unprofessional then respond unprofessional I don't appreciate.
  •  

dargpatTopic starter

Quote from: ilie88 on
ooh now i got it, well i have bad news for you, on facebook it wont play unless you upload the video on your local server, about the twitter i don't know

No, I've gotten it to work on FB! All videos external & local work!;D
  •  

dargpatTopic starter

Quote from: @Mario on
global $video.

thumb_fix($video->thumb);
$video->source (you should check it with an if.


Thanx by the way!
  •  

ilie88

Quote from: dargpat on
No, I've gotten it to work on FB! All videos external & local work!;D

if you check my site i have added meta property's and so on and still doesn't works it would work if it would be a remote to mp4 link but not a youtube
Regards
website: http://www.movietend.com  Don't PM me regarding news about the script's, I'm not from the stuff i am regular user like anyone else, Regards
  •  

dargpatTopic starter

Quote from: ilie88 on
if you check my site i have added meta property's and so on and still doesn't works it would work if it would be a remote to mp4 link but not a youtube
Regards

Not sure if it works with jw6 but it works with jw5 .... check my facebook page link I sent you a couple of days ago .. there are some videos on that page that play that are from youtube .. I'll post a new one to show you so you won't have to search ... it will be the first video
  •  

dargpatTopic starter

Quote from: ilie88 on
if you check my site i have added meta property's and so on and still doesn't works it would work if it would be a remote to mp4 link but not a youtube
Regards

you need a secure url for facebook to work:

<meta property="og:video:secure_url" content="https://path/to/player.swf?file=http://youtubeclip.com" />


I just noticed that from browsing .. not sure if you have complete meta codes or not .. check my site!
  •  

ilie88

Quote from: dargpat on
you need a secure url for facebook to work:

<meta property="og:video:secure_url" content="https://path/to/player.swf?file=http://youtubeclip.com" />


I just noticed that from browsing .. not sure if you have complete meta codes or not .. check my site!

it seems that facebook accepts only https connections it works now, thanks for the tip :D
website: http://www.movietend.com  Don't PM me regarding news about the script's, I'm not from the stuff i am regular user like anyone else, Regards
  •  

Marius P.

Quote from: ilie88 on
it seems that facebook accepts only https connections it works now, thanks for the tip :D

Most don't have a SSL ...
But I don't really see the point to make the video playable on Facebook, from my experience you get 0 traffic to the site when that was an option in PHPVibe, nobody leaves facebook to check the video if they can play it there, better choice it's like I did for VideosQQ, it posts real image, title, etc and you friends click and go to the video page, this way you get traffic on the site, where it matters.
Happy with my help? Buy me a coffee.
Please, always use the search before opening a new topic! We're all here on our (limited) free time! Make sure you help yourself too!
  •  

Marius P.

Here's my simple addon in tpl.globals.php , function meta_add()
<meta property="og:site_name" content="'.get_option('site-logo-text').'" />
<meta property="fb:app_id" content="'.Fb_Key.'">
<meta property="og:url" content="'.canonical().'" />
';
if(com() == video) {
global $video;
$meta .= '
<meta property="og:image" content="'.thumb_fix($video->thumb).'" />
<meta property="og:description" content="'.seo_desc().'"/>
<meta property="og:title" content="'._html($video->title).'" />';
}



just before




return $meta;



Note: in RC1 there is no _html function, but RC2 is releasing today, how ever you can use instead


stripslashes(html_entity_decode($video->title))
Happy with my help? Buy me a coffee.
Please, always use the search before opening a new topic! We're all here on our (limited) free time! Make sure you help yourself too!
  •  

kingofseo

Mario,when will the PHPVibe stable and ready for use it on a live site ?
Clipbucket.info --> phpVibe & ClipBucket Support Community.
  •  

Marius P.

Happy with my help? Buy me a coffee.
Please, always use the search before opening a new topic! We're all here on our (limited) free time! Make sure you help yourself too!
  •  

andy1980

Hi good morning to all
can you help me with this codeI tried it and it worksonly that the video does not play on fb< meta property = "og: video" content = "URL/TO/PLAYER.SWF? file = SOURCE" >instead of SOURCE what do I put?Thank you in advancephpvibe 4.0 use :(
  •  

PHPVibe A.

Quote from: andy1980 on
Hi good morning to all
can you help me with this codeI tried it and it worksonly that the video does not play on fb< meta property = "og: video" content = "URL/TO/PLAYER.SWF? file = SOURCE" >instead of SOURCE what do I put?Thank you in advancephpvibe 4.0 use :(

I think you should read this well:

Quote from: @Mario on
Most don't have a SSL ...
But I don't really see the point to make the video playable on Facebook, from my experience you get 0 traffic to the site when that was an option in PHPVibe, nobody leaves facebook to check the video if they can play it there, better choice it's like I did for VideosQQ, it posts real image, title, etc and you friends click and go to the video page, this way you get traffic on the site, where it matters.

Similar topics (7)