简体   繁体   English

如何在Facebook分享弹出窗口中显示视频缩略图

[英]How to show video thumbnail in Facebook share popup

In the gallery when i am clicking on share video then its showing like that - 在图库中,当我单击共享视频时,其显示如下:

在此处输入图片说明

How can i achieve this, I searched a lot but not get any proper solution, I am using this code for sharing popup - 我如何实现这一目标,我进行了很多搜索,但未找到任何适当的解决方案,我正在使用此代码共享弹出窗口-

  NSString *url_string = @"Video Url"; 
    SLComposeViewController *mySLComposerSheet = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
    [mySLComposerSheet setInitialText:@"Test title"];

    [mySLComposerSheet addURL:[NSURL URLWithString:url_string]];

    if (mediaType == 1]) {
        // Add Image For Image sharing  
        [mySLComposerSheet addImage:[UIImageUtils drawWatermark_in_Image:self.imageView.image]];
    }
    else {
        // Add video thumnail here
    }

    [mySLComposerSheet setCompletionHandler:^(SLComposeViewControllerResult result) {

        switch (result) {
            case SLComposeViewControllerResultCancelled:
                NSLog(@"Post Canceled");
                break;
            case SLComposeViewControllerResultDone:
                NSLog(@"Post Sucessful");
                break;

            default:
                break;
        }
    }];

    [self presentViewController:mySLComposerSheet animated:YES completion:nil];

Take a look at the MPMoviePlayerController class. 看一下MPMoviePlayerController类。 If I remember correctly the requestThumbnailImagesAtTimes() method will return thumbnail images X seconds into the file (you specify how many seconds into the file you want it to perform the capture). 如果我没有记错的话,requestThumbnailImagesAtTimes()方法会将缩略图X秒返回到文件中(您指定要执行捕获的文件秒数)。

If nothing else, it might point you in the right direction if it turns out it won't work for your particular needs. 如果没有别的,它可能会为您指明正确的方向,如果事实证明它不能满足您的特定需求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM