Hanson
Hanson

Reputation: 35

How to embed facebook videos in Android App?

I want to embed facebook videos to my android app. Is there any API for that? I checked for facebook API but it seems it is only for web. If there is no good API, what should I use? WebView or VideoView or anything else?

Upvotes: 2

Views: 1600

Answers (2)

Ben Mc Donnell
Ben Mc Donnell

Reputation: 19

I know this is an old question, but the appropriate way to do this would be to serve up a page from a server that loads the Facebook embedded player. You can find the answer on Facebooks developer platform docs. Search for "Embedded Video & Live Video Player". A working link as of right now is here.

Here's the example code snippet that Facebook provide:

<html> 
<head> 
<title>Your Website Title</title> 
</head> 
<body> 
<!-- Load Facebook SDK for JavaScript -->        
<div id="fb-root"></div> <script async defer src="https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v3.2"></script> 

<!-- Your embedded video player code -->    
<div class="fb-video" data-href="https://www.facebook.com/facebook/videos/10153231379946729/" data-width="500" data-show-text="false"> 
<div class="fb-xfbml-parse-ignore">   
<blockquote cite="https://www.facebook.com/facebook/videos/10153231379946729/"> <a href="https://www.facebook.com/facebook/videos/10153231379946729/">How to Share With Just Friends</a> <p>How to share with just friends.</p> Posted by <a href="https://www.facebook.com/facebook/">Facebook</a> on Friday, December 5, 2014     
</blockquote> 
</div> 
</div> 
</body> 
</html>

It works quite well, but it should be accessed with https as this seems to be a requirement to use the Facebook APIs.

[Edit] Just for extra information. Between the Android webview and Facebook player this is plenty configurable to allow to display the videos as you want.

Upvotes: 1

Jamilur Rahman
Jamilur Rahman

Reputation: 69

I was able to play facebook video by loading this url within webview. But it has some issue for example, can not resize video, can not fully use player control.

"https://www.facebook.com/video/embed?video_id=video_id/"

Upvotes: 1

Related Questions