我想像 Instagram 一样播放视频(如果没有视频则显示图像)?

I want to Play Video(show image if video is not there) Like Instagram?

我想在 UITableViewCell 中播放视频就像 Instagram.If 没有视频那么它必须显示与 Instagram 功能相同的图像。但是我不知道该怎么做。

我下载了 AWEasyVideoPlayer 但它对我没有帮助,

请帮帮我 或分享一些演示,以便我对此有所了解。 提前致谢。

如果您确实尝试过一些东西,我们可以指导您正确的方向或帮助您解决一些困难。因为您还没有发布任何代码,这里是一个关于类似 Instagram 的应用程序的教程。它有点过时,但它引导我朝着正确的方向前进,希望它也能帮助你。

https://www.raywenderlich.com/13511/how-to-create-an-app-like-instagram-with-a-web-service-backend-part-12

Ray Wenderlich 因在 Objective-C 和 Swift 中提供非常好的教程而闻名。

我已经使用这段代码完成了这个功能。

if (videoavailable) {

        cell.Videoplayview.hidden=YES;
          [cell.ImageUploadedimageview sd_setImageWithURL:[NSURL URLWithString:[[allpostdataarray objectAtIndex:indexPath.section] objectForKey:@"post_image"]] placeholderImage:[UIImage imageNamed:@"placeholder.png"]];


    }else{

        cell.Videoplayview.hidden=NO;

               NSString *path = [[allpostdataarray objectAtIndex:indexPath.section] objectForKey:@"post_video"];
        NSURL *videoURL = [NSURL URLWithString:path];
        moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:videoURL];

        [moviePlayer.view setFrame:CGRectMake(0,0, cell.ImageUploadedimageview.frame.size.width , cell.ImageUploadedimageview.frame.size.height)];

        [moviePlayer prepareToPlay];
        [moviePlayer play];
         [cell.Videoplayview addSubview:moviePlayer.view];


}