Can I display a still image in AVPlayer?

I am trying to create a program where I need to display images and videos on an external screen. So, I have a Table View, where I can enter names and links to video files (mp4 at the moment) and image files (jpg at the moment).

I can not find a way to display still images in AVPlayer.

So, to visualize video files or images, I created AVPlayer and UIImageView, which are the same size. AVPlayer is located above the UIImageView.

If I want to display an image, I will hide AVPlayer.

if ([self selectedVideoURL]!=nil){ NSString *myString = [[self selectedVideoURL] absoluteString]; NSString *extension = [myString substringFromIndex: [myString length] - 3]; if (![extension isEqual:@"jpg"]){ self.playerView.hidden = false; [self playingVideo:[self selectedVideoURL]]; } else{ self.playerView.hidden = true; [self displayingImage:[self selectedVideoURL]]; } } 

Is there any way to make this easier?

Thanks...

+5
source share

All Articles