Play mp4/youtube movie while recording with camera - ios

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.

Related

How to play .GIFV and .WEBM on 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];

is it possible to play back from a specific point or time in a MPMediaItem?

Is it possible to play change the playback position from a MPMediaItem? I would like to be able to move between different points in a audio file (say a song) held on the devices iTunes library. Which framework should I be using?
I haven't tried it by myself. But here's a link to documentation that i hope could help you.
You can do it via the AVPlayer. See Using MPMediaItems with AVAudioPlayer for details. Works via the MPMediaItem's URL.

How to capture screen video in iphone?

I want to capture video from screen.
I am unable to capture video from avplayer layer. But, can record from other viewes.
Do I need to search code for OpenGLES?
You can have look at the blog.
I think it covers what you want.
Actually this blog does not use AVPlayer, but rather it uses AVAssetWriter.
Look into the comments there you can get hint using AVPlayer.
Or you can have this project, which is for recording of screen.
These two libraries are the best possible options that you can use to record video of your application screen.
https://github.com/wess/Glimpse
https://everyplay.com/about
Yes I'm working with the same job it comes black screen because of high frameDuration of video .But I've solved this
Don't add AVPlayer to that view. Add to another view and note the time at play and then crop the video of time that has played and after all merge with the recorded video.
I've stated it shortly but I hope you will understand.
You need to work on OpenGLES to render video layer, otherwise it will look black
I would suggest using the GPUImage framework, for a number of reasons:
It IS OpenGL but is wrapped in Objective-C, so there's no need to learn OpenGL to implement it
It is 100% App Store vetted - I have an app in the store that uses it now, as do dozens of others
There is a class named GPUImageMovie that wraps AVAssetReader for playback and another named GPUImageMovieWriter that allows you to write textures to file - these can be the same file, or separate.
There are quite a few examples available within the repository that should be pretty easy to understand...
Source Code / Git Repo
* https://github.com/BradLarson/GPUImage
Blog
* http://www.sunsetlakesoftware.com/2012/02/12/introducing-gpuimage-framework
Hope that helps !
This is good for you testing you achieve that goal through this framework
https://github.com/gabriel/CaptureRecord for screen capture. But, it can be used to record simulator only. You can't submit app to appstore using this code as it use private api.

IOS - saving pictures to be replayed into one video

If anyone has used the app Flipagram, they take pictures that the user submits and then the pictures are replayed all in one video. I need help with how I go about doing that. I'm not to good with integrating camera use and If anyone knew how to help, i would appreciate it.
As suggested in comment you can convert image-list to videos.
Another solution can be :
If you can access those images, then you can use UIImageView and animate the series of images using animationImages method.
Along with this, you can also play audio using AVAudioPlayer if you need to play a sound.

iPhone SDK: Custom video player controls

In my iPhone app I have designed a custom video player, currently it is very basic with just a play pause and stop button,
but I would like the user to be able to scrub, (I think thats the right word) the video like you can do with apple's original media player.
So for Instance I would like to be able to take a UISlider and have it control the current postiion of the videos playback if you get what I mean. Oh and incase your curious, the way I pause/play/stop the video is by using this simple piece of code [self.theMovie play]; [self.theMovie stop]; [self.theMovie pause]; The trouble is I don't know how to scrub the video.
Any help appreciated.
I've asked the same question: customize quicktime iphone and here MPVideoPlayer add/remove buttons
It seams that you have to posibilities:
You can add you view over the main window. An sample can be found here: MoviePlayer Sample
You can iterate through views, found one you need and Add/Remove views. I don't know yet how must does Apple likes/dislikes this method.

Resources