How to play .GIFV and .WEBM on iOS - ios

I am making an reddit client app. So far I have been successfully able to play gif on iOS using FLAnimatedImage library. However for majority of the "gifs" now a days are "gifv" format from imgur and "webm" from gfycat.
Is there any way to play them on iOS? I researched and know that these 2 formats are just fancy videos. However even avplayer won't play them.
The official imgur app is able to play them so there has to be a way.
GIF formats are okay but problem arises for bigger files where we need to download the entire file first and that takes time. GIFV plays continuously without having to download the entire file. Hence I need someway to play them in my app.

#sschale thanks! yes, seems like imgur's gifv is basically mp4 video without audio. So I ended up using avplayer with each URL replaced with mp4 instead of gifv. Same webm replaced with mp4. Added a whole bunch of extra configuration for looping of video etc and got it to work seamlessly. In order for the avplayer to not pause background playing music of other apps, I added:
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryAmbient withOptions:0 error:nil];

Related

AVPlayerViewController video's audio background playing and support for multiple formats

I have to do a Video streaming app (using a remote url) in swift. But there is no any exact video format. Sometimes it can be m3u8 sometimes mp4 etc.. but my video player should support for what ever the format comes from the back end.
Also when the app is in background, the audio should play and when the app comes foreground video should play without any time delay between the vide and the audio.
I want to know whether is it possible to achieve my objectives using AVPlayerViewController or else what is the best player that I can use to achieve my targets. Please help me.
Thanks
AVPlayerViewController supports m3u8 and mp4 both format. For playing video's audio you need some extra configuration. You can check from here...
How do I get my AVPlayer to play while app is in background?
Is it possible to play video using Avplayer in Background?
So according to me AVPlayerViewController is best option for your requirement.

Playing Vimeo Videos with Custom Video Player in iOS

I have to play Vimeo videos in my iOS application using a video player. I need to log events like play, pause, seek etc. Its not possible to play using MPMoviePlayerController or AVPlayer as Vimeo videos have flash content. I am able to play using UIWebView. But, it is showing default Vimeo player controls. I need to have my own controls to play, pause etc as I need to log those events.
I have tried for lot of solutions. Nothing worked. If anyone knows how to play Vimeo videos using custom player. Please Let me know.
I am able to find out solution for this problem. I have used YTVimeoExtractor present here.
Its README.md file says following :
YTVimeoExtractor helps you get mp4 urls which can be use in iOS's native player. You can even choose between mobile, standard and high definition quality.
YTVimeoExtractor doesn't use UIWebView which makes it fast and clean.
I have used MKMoivePlayerViewController and its notifications - MPMoviePlayerPlaybackStateDidChangeNotification and ˚ notifications to get stop, pause events.
The only official way to use a player besides the Vimeo player to play Vimeo videos is to use third-party player urls provided to PRO members: https://vimeo.com/s/adg

iPad Player has a striked out play button for mp4 files sometimes - html5 video tag

I have a HTML5 video tag that serves some mp4 files generated by us and stored on a server which mostly works alright.
But sometimes, the play button is striked out on ipad and the video is not playable. The same video is playable at a different instant.
I cant seem to figure the reason why this happens, that too only sometimes.
Are you by any chance using iOS 3.0? If so there used to be a lot of issues. Including a poster could break the video, and even just including an external javascript could mess it up.

playing multiple videos at the same time

Is it possible to play multiple video in a view.i have tried MPMovieMediaPlayer but only the last added video is playing,is there any other solution to play all files together.
You can use Apple's AVPlayer.

Play mp4/youtube movie while recording with camera

I'm developing my first iOS app, and I need to record a video with the camera while playing a youtube video embedded in a UIWebView. The problem is, the video stops playing when I start the capture.
Is there any workaround? I thought of playing the video in an openGL texture, then play the audio at the same time, but I don't know how to do. I don't need the player to have control buttons, etc.
I've tried to use the RosyWriter sample code and change the input source.
How can this be done?
[EDIT]
I finnaly solved my problem in another way. I don't use RosyWriter anymore, but AVCamRecorder, and for playing video, I get the url of the .mp4 file with PSYoutubeExtractor, then i play it via MPMoviePlayer.
I had to set [[AVAudioSession sharedInstance] setCategory:AVAudioSessionSetCategoryPlayAndRecord error:nil]
Hope this will help someone.
I don't uderstand what you are trying to do. PSYoutubeExtractor doen't record anything, it's only designed to give you the direct MP4 url. To record a tune/movie, you should use an AVAsset, then export it to mp3/mp4.
I'm really sorry, but this project was for my internship in a company, and I havn't keep any piece of code anymore. But if you have a precise problem I already faced, I can try to help you.
Good luck.

Resources