2

我有点卡住了。

我有一个 Joomla 网站,我的应用程序可以正常工作,任何应用程序用户都可以使用 FBui 将某些页面上的视频发布到他们的墙上——但我真正想要的是能够将视频发布到任何地方,我看了使用 og 标签,我已经添加了它们,但视频没有显示 - 我猜我在某个地方遇到了问题或冲突。示例页面:

专辑页面 - http://fnoob.com/archives/P/34-alex-paterson/468-chewy-choosedays-vol-91-100

这是相关的标题部分(我已取出链接+ appid - 我知道它们有效):

    <html xmlns:fb="http://www.facebook.com/2008/fbml" xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://ogp.me/ns#" xml:lang="en-gb" lang="en-gb" slick-uniqueid="3">
<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# video: http://ogp.me/ns/video#"><meta property="fb:app_id" content="my_app_id">
        <meta property="og:type" content="video.other" >
        <meta property="og:url" content="path_to_swf" >
        <meta property="og:image" content="path_to_image" >

再往下,我们有 post to wall 功能,它的工作原理是:

<div id='fb-root'></div>
                <script> 
                var APP_ID='137867843030139';

                window.fbAsyncInit = initFacebook;

                function initFacebook()
                {
                    FB.init({
                        appId  : APP_ID,
                        status : true, // check login status
                        cookie : false, // enable cookies to allow the server to access the session
                        xfbml  : true  // parse XFBML
                        });

                FB.getLoginStatus(onFacebookLoginStatus);
                };

                (function() {
                var e = document.createElement('script');
                e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
                e.async = true;
                document.getElementById('fb-root').appendChild(e);

                }());



    function facebookLogout()
    {
        FB.logout();
        var loginButtonDiv=document.getElementById("fb-login-button-div");
        loginButtonDiv.style.display="block";   
        var logoutButtonDiv=document.getElementById("fb-logout-button-div");
        logoutButtonDiv.style.display="none";   
        var contentDiv=document.getElementById("user-is-authenticated-div");
        contentDiv.style.display="none";            
    }

    function facebookLogin()
    {
        var loginUrl='http://www.facebook.com/dialog/oauth/?'+
            'scope=publish_stream,manage_pages&'+
            'client_id='+APP_ID+'&'+
            'redirect_uri='+document.location.href+'&'+
            'response_type=token';      
        window.location=loginUrl;
    }

    /*
    * Callback function for FB.login
    */

    function onFacebookLoginStatus(response)
    {
        if (response.status=='connected' && response.authResponse)
        {
            var loginButtonDiv=document.getElementById("fb-login-button-div");
            loginButtonDiv.style.display="none";
            var logoutButtonDiv=document.getElementById("fb-logout-button-div");
            logoutButtonDiv.style.display="none";
            var contentDiv=document.getElementById("user-is-authenticated-div");
            contentDiv.style.display="block";

        }
        else
        {
            var loginButtonDiv=document.getElementById("fb-login-button-div");
            loginButtonDiv.style.display="block";   
            var contentDiv=document.getElementById("user-is-authenticated-div");
            contentDiv.style.display="none";            
        }

    }  





    function postToWallUsingFBUi()
    {   
        var data=
        {
            method: 'feed',  
            message: '',
            display: 'iframe',
            caption: '<? echo $this->album->artist_name; ?> Click to Listen',
            name: '<? echo $this->album->name; ?>',
            picture: 'http://fnoob.com/images/albums/<? echo $this->album->image; ?>',   
            source: link_to_file',  
            link: '<? echo $album_link ?>',  // Go here if user click the picture
            description: 'By artist  <? echo $this->album->artist_name; ?> on <? echo $this->album->format_name; ?> and powered by FNOOB.com ',
            actions: [{ name: 'fnoob.com', link: '<? echo $album_link ?>' }],           
        }
        FB.ui(data, onPostToWallCompleted);
    }

    function onPostToWallCompleted(response)
    {
        if (response)
        {
            //console.log(response);
            if (response.error)
            {
                alert(response.error.message);
            }
            else
            {
                if (response.id)
                    alert('Posted.... carry on!');                      
                else if (response.post_id)
                    alert('Posted.... carry on!');
                else
                    alert('Crap... something went wrong');
            }
        }
        // user cancelled
    }

    </script>

所以我想要的基本上是每次在 facebook 上共享此页面(页面、提要等)时,图像和视频会加载,如果单击它会播放并链接到网站上的页面。任何帮助都非常感谢 - 尝试了一天左右的时间。

4

1 回答 1

0

添加这个标签

<meta property="og:video:width" content="640" />
<meta property="og:video:height" content="360" />
<meta property="og:video:type" content="application/x-shockwave-flash" />
<meta property="og:video" content="DIRECT_VIDEO_FILE_URL" />
<meta property="og:video:secure_url" content="DIRECT_VIDEO_FILE_URL_SSL" /> 
<meta property="og:image" content="Image_you_want_to_use_as_thumbnail" /> 
<meta property="og:image:secure_url" content="Image_you_want_to_use_as_thumbnail_SSL" />

视频文件将以 mp4 和 swf 格式工作。
让这个工作的重要部分是你从SSL / HTTPS源传递文件

图像将是播放按钮后面的缩略图

于 2013-08-30T13:39:20.613 回答