我想从我的IOS应用程序到Facebook进行实时视频流。我有两个facebook帐户:第一个 - 注册的iOS应用程序,第二个帐户 - 仅用于测试。如果我使用我的第一个帐户登录(在我的iOS应用程序中) - 我会获得所需的 rtmp://rtmp-api.facebook.com:80 / rtmp URL和流媒体密钥(所有内容)如FB文档中所述:https://developers.facebook.com/docs/videos/live-video-api)。但如果我使用第二个帐户登录,我收到此错误:
com.facebook.sdk:FBSDKGraphRequestErrorParsedJSONResponseKey={
body = {
error = {
code = 100;
"fbtrace_id" = Ed9BmMChIsn;
message = "(#100) No permission to perform current operation.";
type = OAuthException;
};
};
code = 400;
}, com.facebook.sdk:FBSDKGraphRequestErrorHTTPStatusCodeKey=400,
我的直播代码:
- (void)enableFacebookLiveStreamingWithCompletionHandler:(void(^)(NSString* facebookStreamURL, NSString* facebookStreamKey, NSError* error))completionHandler;
{
dispatch_async(dispatch_get_main_queue(), ^{
if ([[FBSDKAccessToken currentAccessToken] hasGranted:permissionPublishActions])
{
NSString* liveVideosRequestPath = [NSString stringWithFormat:@"/%@/live_videos",[FBSDKAccessToken currentAccessToken].userID];
FBSDKGraphRequest* request = [[FBSDKGraphRequest alloc] initWithGraphPath:liveVideosRequestPath parameters:nil HTTPMethod:@"POST"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
NSLog(@"%@",[FBSDKAccessToken currentAccessToken].permissions);
if (error)
{
if (completionHandler)
completionHandler(@"",@"",error);
}
else
{
if (completionHandler)
completionHandler(@"rtmp://rtmp-api.facebook.com:80/rtmp/",[[result objectForKey:@"stream_url"] lastPathComponent],nil);
}
}];
}
});
}
P.S //非常有趣,尽管我已经在此处包含了所有权限:https://developers.facebook.com/tools/explorer,但我拒绝访问第二个用于测试的帐户(应用程序未注册)!
请帮帮我。
答案 0 :(得分:1)
大多数权限需要通过Facebook审核,否则您只能将其用作在App中具有角色的用户。阅读"登录评论"在文档中:https://developers.facebook.com/docs/facebook-login/review