I'm trying to cache srt files and play them with mp4 video files using AVFoundation AVPlayer.
Streaming works fine with webVTT subtitles but I also need to cache videos and subtitles.
I was wondering if this is even possible or a possible workaround exists?
Thanks in advance.
Related
How can I change Video Quality like YouTube?
Currently, I am playing with original quality and I am giving options like 360p, 480p, 720p for changing quality.
How can I change it?
You cant do that simply with AVplayer. you require diffrent URL for different quality video. When user select other quality, you can switch to that video with replaceCurrentItemWithPlayerItem method fo AVPlayer.
AVPlayerItem *playeriem= [AVPlayerItem playerItemWithURL:urlOfSelectedQualityVideo];
[playeriem seekToTime:player.currentTime];
[player replaceCurrentItemWithPlayerItem:playeriem];
In order to do such things like converting video you should use FFmpeg library.
Try to look for some libraries that use ffmpeg on github.
Like this one: https://github.com/iMoreApps/ffmpeg-avplayer-for-ios-tvos
You can't do that with AVPlayer. When just streaming you use M3U index files, TS files containing the video data and just switch streams.
Check out Apple's HLS Documentation and playlist Examples.
You can also create multiple renditions of m3u8 one with lower quality video bitrates say 128k to 650k and another one with 650k + to higher bitrates and use a higher quality stream URL suggested in the answer above
AVPlayerItem *playeriem= [AVPlayerItem playerItemWithURL:urlOfSelectedQualityVideo];
I have some Audio files in mp4 format - which I used thinking this would be the best format for use on both iOS and Android devices. However they do not play with either AVAudioPlayer or AVPlayer. Is there another player that may handle it, or some way (in Swift) to covert them to mp3? Note this only an issue with mp4 audio only files - mp4 videos are fine.
AvPlayer CAN play mp4 files, but not if they are encoded as AMR_NB they need to be encoded as AAC.
I want to play a sequence of videos and images (like Snapchat does). By playing an image I mean having it show on the screen for a certain amount of time. I am using AVFoundation for media capture and playback, and I am using swift to develop this application.
I have .mp4 videos and .jpg images, and I was trying to think of the easiest way to convert the .jpg images to videos such that I could simply add everything to the array of assets that will be passed in as a parameter to the AVQueuePlayer initializer.
Does anybody have any insight on how to do this?
I need to play 3gp, FLV, avi Video file format in my application.
I had searched lot about it.
Got some library like "FFmpeg" Library. But could not find any sample code for it.
Any other ways for it are also appreciated.
Does any body have done it before?
I am even not sure that if it is possible or not in iOS.
Please give me solution for it.
UPDATE :
I tried one 3gp Video in my AVquePlaye but it is not play in my code,
While i use same Video in WhatsApp in my iPhone, Surprisingly video is playing there.
I found out that playing 3gp in the SIMULATOR does not work (because on my mac it uses QuickTime which does not support 3gp, I guess).
When I run my app on a real device, it CAN play 3gp video, using the default video player. So be warned ;)
I am familar with google's swiffy tool and macvide. My question is How can I use one of them or any other tool to convert stream in flash into HTML5 video on the fly.
I imagine you have in hand a Flash-based video player. That is a swf that loads and plays a video stream. You shouldn't try to convert that swf to a Swiffy, but instead just use a HTML5 video player like VideoJS to play the video.