【问题标题】:Facebook open graph embed video issueFacebook 开放图嵌入视频问题
【发布时间】:2018-01-07 14:07:09
【问题描述】:

我网站上的一个页面上有一个 Facebook 分享按钮,这个分享按钮用于分享我网站上的另一个页面。除了共享网站之外,我不希望它执行的唯一特定任务是包含嵌入的 Vimeo 视频,该视频也在该特定页面上。因此有一个 Facebook 共享帖子,它链接到我的特定页面,但也有一个视频播放。到目前为止,我在这个过程中已经走了很远,现在我的问题只是共享帖子有正确的标题、描述、图像和视频,看起来,但是当按下 Facebook 帖子上的“播放”按钮时。它开始缓冲并具有正确的长度和正确的 Vimeo 标题,但它只是保持缓冲而从未真正播放。

如果我要说哪里出了问题,我发现是 Flash 播放器链接,这是错误的,但我无法弄清楚视频的 Vimeo Flash 播放器链接在哪里。目前我的代码如下所示。

在我不想分享的页面上,我有以下“开放图”标签。

<meta property="og:title" content="Test title" />
    <meta property="og:type" content="movie" /> 
    <meta property="og:url" content="http://website.com/siteNum1.html" />
    <meta property="og:description" content="Test description" />

    <meta property="og:image" content="https://i.vimeocdn.com/filter/specialThumbnailImage.png"/>
    <meta property="og:video" content="https://vimeo.com/moogaloop.swf?clip_id=specialID" />
    <meta property="og:video:type" content="application/x-shockwave-flash" />
    <meta property="og:video:width" content="640" />
    <meta property="og:video:height" content="360" />

    <meta property="og:video" content="https://player.vimeo.com/video/specialID?autoplay=1&title=0&byline=0&portrait=0" />
    <meta property="og:video:type" content="video/mp4"/>
    <meta property="og:video:width" content="640" />
    <meta property="og:video:height" content="360" />

在页面上,我有共享按钮,如下所示。

<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.9";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

<div class="col-lg-4">
                <div class="faceBkShare">
                    <h3>Share on Facebook</h3>
                    <img src="fbPost1.png" alt="fb post inspiration" class="img-responsive center-block">
                    <p>Some text</p>
                    <div class="fb-share-button" data-href="http://website.com/siteNum1.html" data-layout="button" data-size="large" data-mobile-iframe="true">
                    </div>
                </div>
             </div>

我从以下question/answer得到灵感

【问题讨论】:

  • 您使用的两个“视频”网址都返回 HTML 文档 - 不是您声称的 flash 或 mp4。
  • @CBroe 我明白了,但我不完全确定如何包含 Vimeo 视频,因为我找不到 Flash 链接。我可以在其他答案中看到他们有一些特定的 Flash 网络播放器链接,我无法找到我上传的 Vimeo 视频。

标签: javascript facebook facebook-graph-api share embed


【解决方案1】:

我发现 Vimeo 有一个需要链接,其中有一个示例,说明您在尝试共享视频并将其链接到您的网站时需要的所有开放图形标签。 This is that link

使用此链接,我最终得到了以下代码。

    <meta property="og:site_name" content="My sites name">
<meta property="og:url" content="http://website.com/siteNum1.html">
<meta property="og:type" content="video">
<meta property="og:title" content="Title of site/video">
<meta property="og:description" content="the description">
<meta property="og:image" content="https://longlinkforthumbnailimage.png">
<meta property="og:image:secure_url" content="https://longlinkforthumbnailimage.png">
<meta property="og:image:type" content="image/png">
<meta property="og:image:width" content="1280">
<meta property="og:image:height" content="720">
<meta property="og:video:url" content="https://player.vimeo.com/video/SpecialID?autoplay=1">
<meta property="og:video:secure_url" content="https://player.vimeo.com/video/SpecialID?autoplay=1">
<meta property="og:video:type" content="text/html">
<meta property="og:video:width" content="1280">
<meta property="og:video:height" content="720">
<meta property="og:video:url" content="https://vimeo.com/moogaloop.swf?clip_id=SpecialID&amp;autoplay=1">
<meta property="og:video:secure_url" content="https://vimeo.com/moogaloop.swf?clip_id=SpecialID&amp;autoplay=1">
<meta property="og:video:type" content="application/x-shockwave-flash">
<meta property="og:video:width" content="1280">
<meta property="og:video:height" content="720">

如果有人和我有同样的问题,我希望这会有所帮助。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-08-16
    • 2010-11-10
    • 2022-10-13
    • 2019-05-17
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多