1

ShareKit のいくつかのフォークを使用して、ビデオを Facebook に投稿することは可能ですか? Facebook グラフ API 全体を自分で台無しにしたくはありませんが、動画を投稿する機能が欲しいです。

4

2 に答える 2

1

Facebook などの一部のサービスでは、 ShareKit 2.0 リポジトリにビデオ共有のプル リクエストがあります。未解決の問題がいくつかあるため、まだマージされていません。最も深刻な問題は、大きなビデオを共有するとデバイスのメモリが使い果たされることです。

しかし、それはあなたにとって良いスタートかもしれません。

于 2012-04-30T09:03:54.163 に答える
0

sharekit を使用する代わりに、これには FBGraphAPI を使用することをお勧めします...

Facebook に動画を投稿する手順は次のとおりです。

.h ファイル内

#import "FbGraph.h"
#import "FbGraphFile.h"
#import "JSON.h"
#import <MobileCoreServices/MobileCoreServices.h>

@interface ViewController : UIViewController
{
    FbGraph                 *FB_Graph;
    FbGraphResponse         *FB_Graph_Response;
    FbGraphFile             *FB_Graph_File;
}

-(IBAction)btnShareVideoPress:(id)sender;

@end

.m ファイルでこのメソッドを呼び出します.....

- (void)viewDidAppear:(BOOL)animated
{
   [super viewDidAppear:animated];

  NSString *ClientID = @"197556430726736";

  FB_Graph = [[FbGraph alloc]initWithFbClientID:ClientID];

  [FB_Graph authenticateUserWithCallbackObject:self      andSelector:@selector(fbGraphCallback:) andExtendedPermissions:@"user_photos,user_videos,publish_stream,offline_access,user_checkins,friends_checkins"];

 }

-(IBAction)btnShareVideoPress:(id)sender
{

NSString *path = [[NSBundle mainBundle] pathForResource:@"YouTubeTest" ofType:@"m4v"]; 
NSURL *videoURL1=[NSURL fileURLWithPath:path];

NSMutableDictionary *variables = [[NSMutableDictionary alloc]init];

FB_Graph_File = [[[FbGraphFile alloc] initwithURL:videoURL1]retain];

[variables setObject:FB_Graph_File forKey:@"file"];

[variables setObject:@"Test video upload 1" forKey:@"message"];
[variables setObject:@"video" forKey:@"MediaType"];
[FB_Graph doGraphPost:@"me/videos" withPostVars:variables];

FbGraphResponse *fb_graphresponse = [FB_Graph doGraphGet:@"me/videos/uploaded" withGetVars:variables];  

NSLog(@"postPictureButtonPressed:  %@", fb_graphresponse.htmlResponse);

 }
于 2012-07-11T06:22:38.760 に答える