如何在Android上分享视频到Facebook(How to share video to Facebook on Android)
我尝试从android集成的Facebook集成中引用
这是我的一步
第1步:尝试导入Facebook SDK
repositories { mavenCentral() } dependencies { ... compile 'com.android.support.constraint:constraint-layout:1.0.2' ... }
Step2:在Manifests上设置代码,333991926986699是我的Facebook app_id
<uses-permission android:name="android.permission.INTERNET"/> <application .... <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/> <provider android:authorities="com.facebook.app.FacebookContentProvider333991926986699" android:name="com.facebook.FacebookContentProvider" android:exported="true" /> .... </application>
然后关于从官方分享视频代码是这样的:
Uri videoFileUri = ... ShareVideo = new ShareVideo.Builder() .setLocalUrl(videoUrl) .build(); ShareVideoContent content = new ShareVideoContent.Builder() .setVideo(video) .build();
我不知道如何让它发挥作用。
这是我的视频链接 。 任何人都可以教我下一步应该做什么?
任何帮助,将不胜感激。
这是我尝试共享代码:
shareButton=(Button)findViewById(R.id.shareButton); shareButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Uri videoFileUri=Uri.parse("https://www.youtube.com/watch?v=zeLqNx7dMBM"); ShareVideo shareVideo=new ShareVideo.Builder() .setLocalUrl(videoFileUri) .build(); //There is no use by content ShareVideoContent content=new ShareVideoContent.Builder() .setVideo(shareVideo) .build(); } });
I try to take a reference from Facebook integration in android
Here is my step
Step1: Try to import Facebook SDK
repositories { mavenCentral() } dependencies { ... compile 'com.android.support.constraint:constraint-layout:1.0.2' ... }
Step2: Set the code on Manifests,333991926986699 is My Facebook app_id
<uses-permission android:name="android.permission.INTERNET"/> <application .... <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/> <provider android:authorities="com.facebook.app.FacebookContentProvider333991926986699" android:name="com.facebook.FacebookContentProvider" android:exported="true" /> .... </application>
And then about sharing video code from official is like this:
Uri videoFileUri = ... ShareVideo = new ShareVideo.Builder() .setLocalUrl(videoUrl) .build(); ShareVideoContent content = new ShareVideoContent.Builder() .setVideo(video) .build();
I have no idea how to let it work .
This is my video link. Can anyone teach me what next should I do?
Any help would be appreciated.
Here is i try to share code:
shareButton=(Button)findViewById(R.id.shareButton); shareButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Uri videoFileUri=Uri.parse("https://www.youtube.com/watch?v=zeLqNx7dMBM"); ShareVideo shareVideo=new ShareVideo.Builder() .setLocalUrl(videoFileUri) .build(); //There is no use by content ShareVideoContent content=new ShareVideoContent.Builder() .setVideo(shareVideo) .build(); } });
原文:https://stackoverflow.com/questions/43336159
最满意答案
这是github上很棒的图书馆
here is great library on github for doing this
相关问答
更多-
数据库复制或镜像?(Database Replication or Mirroring?)[2022-03-14]
简而言之,镜像允许您让第二台服务器成为主服务器的“热”备份副本,随时准备接管主服务器发生故障的任何时刻。 所以镜像提供故障切换和可靠性。 另一方面,复制允许两台或更多服务器保持“同步” - 这意味着辅助服务器可以回答查询并(取决于设置)实际更改数据(它将在同步中合并)。 您也可以将其用于本地缓存,负载平衡等。 In short, mirroring allows you to have a second server be a "hot" stand-by copy of the main server, ... -
检查这些物品: 2。 镜像数据库必须从主体服务器的完全备份创建,并应在“使用Norecovery进行恢复”模型中进行恢复。 紧接着还原主数据库的事务日志备份,以使镜像和主数据库的日志序列号相互同步。 3。 镜像数据库必须与主体数据库具有相同的名称。 ... 8。 数据库镜像可用于企业版,开发人员版和标准版,但请参阅Microsoft网站以获取比较图,因为某些功能在标准版中不可用。 SQL Server Workgroup和Express Editions只能用作见证服务器。 数据库镜像在Microsoft ...
-
AVCaptureVideoPreviewLayer镜像iPhone 4和iPad 2(AVCaptureVideoPreviewLayer mirroring iPhone 4 and iPad 2)[2023-02-03]
不要忘记AVCapturePreviewLayer本质上是一个核心动画层。 我不确切地知道你想要什么,但是要切换CALayer镜像你可以使用UISwitch并定义它的IBAction来翻转预览层,如下所示: yourPreviewLayer.transform = CATransform3DMakeRotation(M_PI, 0.0f, 1.0f, 0.0f); 这将使您的图层水平翻转180º,提供镜面效果,并为开关关闭位置,它将再旋转180º,取消效果。 祝你好运。 Don't forget ... -
有几种类型的复制,当您需要将数据子集从一个服务器发送到另一个服务器时,通常使用事务复制(可能是最常用的形式),例如将数据从生产服务器发送到报告数据库等 来自technet的关于复制的引用: 事务复制通常用于需要高吞吐量的服务器到服务器方案,包括:提高可伸缩性和可用性; 数据仓库和报告; 整合来自多个站点的数据; 整合异构数据; 和卸载批处理。 合并复制主要用于可能存在数据冲突的移动应用程序或分布式服务器应用程序。 常见方案包括:与移动用户交换数据; 消费者销售点(POS)应用程序; 和来自多个站点的数据集成 ...
-
SQL Mirroring 2008 R2(SQL Mirroring 2008 R2)[2022-02-01]
我已经解决了自己的问题,看起来SQL Server驱动程序无法识别故障转移伙伴,我将连接字符串更改为: Driver={SQL Server Native Client 10.0};Failover_Partner=WCFTEPATSQL02;Server=WCFTEPATSQL01;Database=DBForms;Trusted_Connection=yes;Network=dbmssocn;Pooling=false 一切都很好。 I have solved my own issue, it loo ... -
在iOS 7中,可以通过您设置的音频类别确定Airplay选项(如QA1803中所述 )。 因为我正在使用AVAudioSessionCategoryPlayAndRecord应该正常工作。 这可能是一个错误。 如果您遇到同样的问题,请复制。 In iOS 7 Airplay options can be determined by the Audio Category you set (as discussed in QA1803). Since I'm using AVAudioSessionCateg ...
-
我可以通过在此答案中使用解决方案来解决此问题: 如何检查设备是否通过airplay连接? 不是最好的解决方案,但可能是唯一可用的解决方案。 I could solve this by using the solution in this answer: How to check if the device is connected via airplay? Not the best solution, but probably the only available one.
-
将一个窗口镜像到另一个窗口(Mirroring one window to another)[2022-07-21]
解决方案是我使用DWM缩略图作为源窗口: hr = DwmRegisterThumbnail(); hr = DwmUpdateThumbnailProperties(); 正如@ raymond-chen所说。 The solution was that I used DWM thumbnailing for the source window: hr = DwmRegisterThumbnail(); hr = DwmUpdateThumbnailProperties(); as @raymond- ... -
UIimageView镜像(UIimageView mirroring)[2023-06-29]
这是github上很棒的图书馆 https://github.com/nicklockwood/ReflectionView here is great library on github for doing this https://github.com/nicklockwood/ReflectionView -
镜像nexus(Mirroring nexus)[2023-02-22]
这是正确的方法。 设置远程位置以镜像主要Nexus。 (以管理员身份登录,存储库,添加,代理存储库。 然后在开发人员的Maven settings.xml中添加远程位置的Nexus作为主要Nexus的镜像。 首先,访问工件被复制到远程位置。 而已。 That is the right way. Set up your remote location to mirror the main Nexus. (Login as admin, Repositories, Add, Proxy Repository. ...