通过应用程序将带有参数的swf发布到facebook

时间:2012-04-04 19:35:18

标签: facebook flash facebook-graph-api

我有一个Facebook应用程序,用户选择他的4个朋友,然后创建一个视频(swf),其中包含你朋友的照片(通过xml加载)。所以我需要在用户时间轴上分享这个视频。一切正常,但视频没有嵌入时间轴上的帖子中,只有一个帖子中有链接到页面。

奇怪的是,如果我直接在我的时间轴上发布网址,则会嵌入视频,但如果通过应用程序发布相同的链接则不会。

这是我的代码,由js中的分享按钮调用:

function postToFeed() {
    var obj = {
      method: 'feed',
      link: 'https://mysite.com/flash/share-page.php?id=22',
      picture: 'https://mysite.com/images/video-preview.jpg',
      name: 'Name',
      caption: 'Caption',
      description: 'Description'
    };

    function callback(response) {
      //some code here
    }

    FB.ui(obj, callback);
  }

和我的share-page.php中的代码

<?php

$id_inscription = $_GET['id'];

$video_url = 'https://mysite.com/flash/share-page.php?id=22';
$video_preview_image = 'https://mysite.com/images/video-preview.jpg';

?>

<!DOCTYPE html>
<html>
<head>
    <title>Title</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta http-equiv="content-language" content="en">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />

<meta property="og:video" content="<?php echo $video_url; ?>"/>

<!-- Open grah tags for Facebook -->
<meta property="og:title" content="Test video player" />
<meta property="og:description" content="A video player interface experiment." />
<meta property="og:type" content="video" />
<meta property="og:url" content="<?php echo $video_url; ?>"/>
<meta property="og:image" content="<?php echo $video_preview_image; ?>"/>
<meta property="og:site_name" content="Site name"/>

<!-- Video specific open graph tags -->
<meta property="og:video" content="<?php echo $video_url; ?>" />
<meta property="og:video:secure_url" content="<?php echo $video_url; ?>" /> <!-- Required for people on Facebook who have secure browsing enabled! -->
<meta property="og:video:width" content="325" />
<meta property="og:video:height" content="180" />
<meta property="og:video:type" content="application/x-shockwave-flash" />


<script src="js/swfobject.js"></script>
<script>
    var flashvars = {
        xmlUrl:"xml/data-<?php echo $id_inscription; ?>.xml",
        policyFileUrl:"http://profile.ak.fbcdn.net/crossdomain.xml"
    };
    var params = {
        menu: "false",
        scale: "noScale",
        allowFullscreen: "true",
        allowScriptAccess: "always",
        bgcolor: "",
        wmode: "opaque"
        //wmode: "direct" // can cause issues with FP settings & webcam
    };
    var attributes = {
        id:"content"
    };
    swfobject.embedSWF(
        "app.swf",
        "altContent", "480", "270", "10.0.0",
        "expressInstall.swf",
        flashvars, params, attributes);
</script>
</head>

<body>
<div id="altContent">
    <p><a href="http://www.adobe.com/go/getflashplayer">Get Adobe Flash player</a></p>
</div>
</body>

</html>

2 个答案:

答案 0 :(得分:0)

找到它,在javascript中你必须添加

source: 'https://mysite.com/flash/app.swf'

答案 1 :(得分:0)

为我工作。 另外facebook说,它不应该按设计工作。

https://developers.facebook.com/bugs/589975484398226?browse=external_tasks_search_results_526fc388b99e18881434478

如果可以使用,请在此处分享您的代码段。我有meta标签也照顾安全视频Url。