开发者

video published with Facebook-SDK not playing in iPhone facebook app

I have an iphone app that lets users post a 'story' to their facebook wall. This story contains a youtube video as part of the message. The video loads and plays normally from the standard web-browser facebook client, but fails to load from the iphone facebook app. When the user selects the video link from the iPhone facebook app a blank white view is pushed onto the navigation controller view-stack. Is there a way to get the link to trigger the iOS to load the youtube app?

SBJSON *jsonWriter = [[SBJSON new] autorelease];

        NSDictionary* actionLinks = [NSArray arrayWithObjects:[NSDictionary dictionaryWithObjectsAndKeys: 
                                                               @"#####",@"text",
                                                               @"http://www.facebook.com/#####",@"href",
                                                               nil], nil];

        NSString *actionLinksStr = [jsonWriter stringWithObject:actionLinks];

        NSString *video_link = @"http://www.youtube.com/v/#####";
        NSString *image_link = @"http://i.ytimg.com/vi/#####/2.jpg";

        NSDictionary *video_share = [NSDictionary dictionaryWithObjectsAndKeys:
                                     @"flash",      @"type",
                                     video_link,    @"swfsrc",
                                     image_link,    @"imgsrc",
                                     @"100",        @"width",
                                     @"80",         @"height",
                                     @"400",        @"expanded_width",
                                     @"320",        @"expanded_height",
                                     nil];

        NSString *caption = @"#####";
        NSString *description = @"";
        NSString *name = @"#####";
        NSString *url = @"http://www.#####.com/";

        NSDictionary* attachment = [NSDictionary dictionaryWithObjectsAndKeys:
                                    name, @"name",
                                    caption, @"caption",
                                    description, @"description",
                                    [开发者_JAVA百科NSArray arrayWithObjects:video_share,nil], @"media",
                                    url, @"href", nil];

        NSString *attachmentStr = [jsonWriter stringWithObject:attachment];

        NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                       kFBAppId, @"api_key",
                                       @"#####",  @"user_message_prompt",
                                       actionLinksStr, @"action_links",
                                       attachmentStr, @"attachment",
                                       nil];

        [facebook dialog: @"stream.publish"
               andParams: params
             andDelegate: self];


if you are testing on simulator and opening link in webview, youtube video will not be play or load.

but it will play on device i-e iphone/ipad/ipod.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜