在本文中,您将会了解到关于如何在youtube等Facebook上分享我网站上的视频的新资讯,同时我们还将为您解释youtube视频分享到facebook的相关在本文中,我们将带你探索如何在youtu
在本文中,您将会了解到关于如何在youtube等Facebook上分享我网站上的视频的新资讯,同时我们还将为您解释youtube视频分享到facebook的相关在本文中,我们将带你探索如何在youtube等Facebook上分享我网站上的视频的奥秘,分析youtube视频分享到facebook的特点,并给出一些关于android – 在Facebook上分享Google Play链接和错误的缩略图、android – 在Facebook上分享HTML内容、angularjs – 在Facebook上分享时,显示角括号而不是内容、Facebook分享视频例外“分享视频必须在Android上引用设备上的视频”的实用技巧。
本文目录一览:- 如何在youtube等Facebook上分享我网站上的视频(youtube视频分享到facebook)
- android – 在Facebook上分享Google Play链接和错误的缩略图
- android – 在Facebook上分享HTML内容
- angularjs – 在Facebook上分享时,显示角括号而不是内容
- Facebook分享视频例外“分享视频必须在Android上引用设备上的视频”
如何在youtube等Facebook上分享我网站上的视频(youtube视频分享到facebook)
我有一个拥有HTML5视频播放器的网站。
我想在Facebook上共享链接,并且用户之一在facebook上单击该帖子的图像,它就会开始在此处播放视频。
就像youtube视频和vimeo视频一样。
我怎样才能做到这一点?
谢谢
答案1
小编典典我有一个拥有HTML5视频播放器的网站。
您想找到一个好的SWF(*.SWF)视频播放器,该视频播放器可以将视频从url={video_Hot_link}
(将URL
参数传递给SWF
播放器)
现在,当您准备好要播放流式视频的SWF播放器后,将Facebook Open Graph添加
到<head>
标签中,如下所示:
<meta property="og:type" content="video"> <!-- site/page type more information http://ogp.me/ --><meta property="og:video:type" content="application/x-shockwave-flash"> <!-- you need this because your player is a SWF player --><meta property="og:video:width" content="Width in Pixels"> <!-- player width --><meta property="og:video:height" content="Height in Pixels"> <!-- player height --><meta property="og:video" content="http://example.com/{path_to}/{swf_player}.swf?url={video_soure}"> <!-- You will need to echo/print the video source (*.mp4) with server-side code --><meta property="og:video:secure_url" content="https://example.com/{path_to}/{swf_player}.swf?url={video_soure}"> <!-- required for users whom use SSL (actually Facebook forces everyone to use SSL so you''re required to use og:video:secure_url) so get a one -->
另外,您需要将以下前缀添加到<html>
likeso
<html prefix="og: http://ogp.me/ns#">
android – 在Facebook上分享Google Play链接和错误的缩略图
当我试图在我的Android Facebook应用程序上发布链接时,缩略图是错误的.它是来自网站的随机图像.我有:
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT, "my google play link");
startActivity(Intent.createChooser(intent, "Share with"));
我该如何解决这个问题?
解决方法:
你无法解决这个问题,Google的Play商店在他们的网页上没有og metadata tags来指定在Facebook上分享时使用的图像.因此,Facebook将只选择一个在作曲家中展示,并且你无法做多少改变.
android – 在Facebook上分享HTML内容
解决方法
angularjs – 在Facebook上分享时,显示角括号而不是内容
码:
<div ng-controller="MyCtrl"> <title>{{mDetails.display1}} - Subtitle</title> <Meta name="description" content="{{mDetails.display1}} - {{mDetails.address1}},{{mDetails.city}},{{mDetails.state}},{{mDetails.country}}"> . .
注意:我已经在使用ng-cloak了.
感谢帮助.
og meta tags,social buttons and angularjs
方法1: –
这不能使用javascript完成.有些人认为Facebook正在阅读当前页面上的内容.不是.它使用相同的URL(来自window.location.href)使用它的Scraper向您的服务器发出单独的请求,而Facebook Scraper不运行javascript.这就是为什么你点击像Facebook分享按钮这样的东西时会得到{{page_title}}.您的内容必须由服务器生成,因此当Facebook访问该网址时,它可以预先获得所需的内容,而无需使用javascript.您可以通过几种方式处理服务器端渲染.
You can allow your server side technology to render the content. You can use the PhantomJS approach https://github.com/steeve/angular-SEO.
方法2: –
您还可以重新渲染Facebook小部件.使用他们的解析方法:
FB.XFBML.parse();
在你的角色的东西完成后.它不适用于我的分享按钮(还有!!),但我在喜欢上测试它,这很酷.基本上它重新扫描DOM并呈现Facebook小部件.你也可以传递一个单独的元素,就像这个指令:
'use strict'; angular.module('ngApp') .directive("fbLike",function($rootScope) { return function (scope,iElement,iAttrs) { if (FB && scope.$last) { FB.XFBML.parse(iElement[0]); } }; });
在创建角度转发器中的最后一个元素时,此片段将重新扫描用于html5 facebook fb类小部件的DOM.
在同一背景下另一个被接受的答案: –
https://stackoverflow.com/a/24086652/1366216
编辑:
我在服务器端实现了json仅用于元标记,但是它的开销是因为对于页面数据,仍然存在ajax调用.
$mid=$_GET['id']; $mJSON = file_get_contents($homeurl."/json/getdetail.PHP?mid=".$mid); $mObject = json_decode($mJSON,true); if ($mObject['ID'] != undefined && $mObject['ID'] != '') { <Meta property="og:title" content="<?PHP echo $mObject['display1'];?>"/> <Meta property="og:description" content="<?PHP echo .$mObject['display2']; ?>"/> }
Facebook分享视频例外“分享视频必须在Android上引用设备上的视频”
我通过Gradle使用Facebook Android sdk 4.6.0.
我正在尝试根据Sharing on Facebook guidenline配置Facebook后从移动目录上传视频,但我得到例外“ShareVideo必须引用设备上的视频”在sharedialog.show调用之后.通过对onError(FacebookException异常)的回调向我报告异常.
/**first checking if file exist than execute code, file exits and code execute but after executing callback with exception "Share Video must reference a video that is on the device" occurs
**/ private void shareOnFacebook() {
File dir = new File(Environment.getExternalStorageDirectory(),
"directory");
File video = new File(dir, "Video.mp4");
if (video.exists()) {//if video file exist
Uri videoFileUri = Uri.parse(video.getPath());
ShareVideo sv = new ShareVideo.Builder()
.setLocalUrl(videoFileUri)
.build();
ShareVideoContent content = new ShareVideoContent.Builder()
.setVideo(sv)
.build();
shareDialog.show(content); //show facebook sharing screen with video
}
}
解决方法:
抛出异常:
https://github.com/facebook/facebook-android-sdk/blob/master/facebook/src/com/facebook/share/internal/ShareContentValidation.java;
if (!Utility.isContentUri(localUri) && !Utility.isFileUri(localUri)) {
throw new FacebookException("ShareVideo must reference a video that is on the device");}
public static boolean isContentUri(final Uri uri) {
return (uri != null) && ("content".equalsIgnoreCase(uri.getScheme()));
}
public static boolean isFileUri(final Uri uri) {
return (uri != null) && ("file".equalsIgnoreCase(uri.getScheme()));
}
如你所见,fb share sdk正在检查uri是否有一个方案.
在您的情况下,当您从video.getPath创建uri时,scheme为null.你应该做的是从视频文件创建uri:
Uri videoFileUri = Uri.fromFile(视频);
今天关于如何在youtube等Facebook上分享我网站上的视频和youtube视频分享到facebook的介绍到此结束,谢谢您的阅读,有关android – 在Facebook上分享Google Play链接和错误的缩略图、android – 在Facebook上分享HTML内容、angularjs – 在Facebook上分享时,显示角括号而不是内容、Facebook分享视频例外“分享视频必须在Android上引用设备上的视频”等更多相关知识的信息可以在本站进行查询。
本文标签: