Facebook通过应用程序发布swf

时间:2012-12-03 17:47:01

标签: javascript facebook facebook-graph-api facebook-javascript-sdk

我有点卡住了。

我有一个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-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上共享(页面,提要等),图像和视频加载,如果点击它播放并链接到网站上的页面。任何帮助都非常赞赏 - 一直试图找出它一天左右。

1 个答案:

答案 0 :(得分: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 来源

提交文件

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