display two different Video-Streams at the same time - iphone

I try to display two different http/rtsp-Video-Streams at the same time on the same UIView.
So my first thought was to use the UIViews of two MPMoviePlayerController.
But the documentation says:
Note: Although you may create multiple MPMoviePlayerController objects and present their views in your interface, only one movie player at a time may play its movie.
Okey!
My second thought was to use the UIWebView.
But that also doesn't work. I can display only one stream.
I hope you can help me.
Best regards.

On iPhone, as the documentation says, only one Video can be shown at any point. Video has to be full Screen! check also:
Customizable non-full screen video player in iPhone

Related

Add multiple MPMoviePlayerController on UIScrollView?

I'm new at iOS development;
I add two MPMoviePlayerController on my scrollView for play audio file.
All is well but problem is any one media player such like
I am sure that my URL of file is proper. Then is issue here.
I don't know that Apple's iOS provide feature that we can add only one media player??
Please give me any suggestion.
It is very important for my application to add two MPMoviePlayerController so user can display TWO Media player.
I think you can add multiple MPMoviePlayerController objects, though only one can play a file at one time.
This is from Apple Documentation:
Note: Although you can create multiple MPMoviePlayerController objects
and present their views in your interface, only one movie player at a
time can play its movie.
Here is the link.
I know that you can play multiple videos in a single view by using the Apple AVFoundation framework (rather than MPMoviePlayerController). I imagine this is true of audio files as well.
Here is a similar SO question with tips about implementing AVFoundation.
I was having a similar issue with multiple MPMoviePlayerControllers in a UIScrollView, my solution being to add the media programatically to scrollViewDidEndDecelerating.
Not ideal because you then have to work around the fact the media isn't there until the scroll is finished but a nice bit of animation is working quite well in my case.

iPhone Use UIImagePickerController to capture selective frames from a video

I wanted to use the UiImagePicker to record a video then let the user browse the frames using the scrollview built in the UiImagePicker and while at it, select a few frames that interest the user.
I know I can overlay a control on top of the uiimagepicker to trigger the selection
What I am not sure about is whether I have programatic access to the current frame shown by the UIImagePicker for me to extract an image out of it.
Please let me know if this is doable/possible.
Are there any other time efficient/elegant ways to achieving the above?
I had created by own view with video recording and frame selection (using AVCaptureSession, AVCaptureVideoDataOutput) but would take me quite a bit of time to polish it to make it look good like UIImagePicker plus everyone is familiar with the default camera app in the iPhone.
I hope it makes sense what I want to achieve.
I know one can kind of achieve the goal by taken a screenshot of the screen but I just want the user to click one button to capture the current show frame.
Thanks
Screenshot method did not work for frozen frame from the video recording.
Went with a custom AVFoundation based frame capture.

iPhone Smooth Transition from One Video To Another

I have to figure out the best way to transition from one video to the next
BASIC IDEA: An example would be that there is a video of a person walking.....the user taps the video and a seamless transition occurs to a video of a person running (over simplified example)
My first thought was to create 2 movie players and use transitions between the 2 view elements. But movie-player doesn't support that.
stopping the current video, loading new content, and then starting it is a solution but not very elegant. We are making a interactive sales tool for our reps and we want this to look as professional as possible.
CURRENT THOUGHT: If there was some sample code for AVPlayer, it would seem I could use AVVideoComposition to switch between videos? But details on how that might happen don't seem to be currently available.
POSSIBLE CLUE: I figured this would be easy as I bought an app called Live Cams HD that shows 16 different video feeds at once.
Any ideas? Thanks in advance!
Steve, the short answer is that you are not going to be able to get the kind of results you want using AVPlayer. The h.264 video logic included in iOS is really great at playing video and video/audio together, but it really sucks at starting/stopping and switching from one clip to another. The reason is that there is a lot of buffering that needs to happen to load up and start playing a h.264 video in hardware. Basically, you need to roll your own code that sets UIImage/CGImageRef for your views in a way that makes it easy to switch from one clip to another by simply switching from one array of UIImage objects to another. Of course, that is easy to say yet not so easy to implement.
What I would suggest is that you evaluate existing code that already implements this logic instead of rolling your own. For example, have a look at this StreetFighter demo app. It shows how a very simple game like iPhone UI can be constructed using a series of clips that show a character doing a kick, a punch, or throwing a fireball. The results looks like this:
I also wrote up a blog post about seamless-video-looping-on-ios. You can of course roll your own code to do all this, but I would suggest reading more about my library at the linked website as it will save you a lot of time.
After the first video has played every frame except the last one, you quickly swap to a view with an image of the last frame (basically the last frame) and then you transition into a view with the an image of the first frame of the next video and start up that one.
Or you could create a animation with all your frames (programming your videos), that will make it customizable, but the quality will probably not be as good and the cpu usage can spike, so you will have to make a call on that one.

Open video in iPhone without controls

I am trying to play video without showing controls (volume and other buttons) but it also should be possible to make them visible by taping on the video.
The code is:
theMovie.scalingMode = MPMovieScalingModeAspectFill;
theMovie.movieControlMode = MPMovieControlModeDefault;
In this case it shows the controls by default and by taping on the video they get hidden.
If I change the mode to MPMovieControlModeHidden then I can not see the controls but also I can not bring them back.
Is there a way to start video without controls but not disabling them completely?
Good news Dmitriy!
I've found a solution that will do the job for you, I hope.
It is as follows:
Initialize your
MPMoviePlayerController object's
movieControlMode property with
MPMovieControlModeHidden value
Play the movie
After the movie playback has started set your MPMoviePlayerController object's movieControlMode property back to MPMovieControlModeDefault
Third step can be accomplished by observing MPMoviePlayerContentPreloadDidFinishNotification notification. Though this might cause unresponsive black screen (or of another color you've set as your MPMoviePlayerController object's backgroundColor) in case you will play a streaming video, which be actually preloaded by MPMoviePlayerController. I don't have any movie of compatible format on a remote server at my disposal right now so I can't test this scenario is real and therefore mess around to see if there's something that can be done to avoid this side effect (though I think I will do that if you publish or find such movie for testing somewhere in the Internet).
Tip: look at the bold piece of text if you don't want to know my long story about how boring I am actually starting to look into a problem by reading the documentation and looking into the sample code it offers.
You question has interested me so I started from looking at MPMoviePlayerController Class Reference on iPhone Dev Center. I didn't actually find anything related to the problem you've stumbled upon so I've decided to play around with this sample project MPMoviePlayerController reference - MoviePlayer. I juts wanted to reproduce your situation and maybe try dealing with it by simulating a single touch event or triggering the same method that responds to this event manually.
But it turned out that Apple's sample project in fact behaves absolutely like you want your's to. It starts video playback and the overlay controls are automagically animated out of the screen from the very beginning. I've looked through the code, it's rather simple and doesn't really 'deal' in any way with this problem you have. So maybe it's something you do (or do in somewhat not right order) that causes the problem. Check it out and get back to us with a cure because judging by usefulness metric there are people who have similar problems.

Small video playback

From what I have gathered from internets the MPMoviePlayerController class doesn't support small video playback. So, in an effort to beat a dead horse I was wondering what kind of methods could be used to get a small video playing in a corner of the screen without interrupting the rest of the screen.
So far we've come across two solutions that may work: using a UIImageView and flopping images through it like a madman and using a large fullscreen video with all the animations we need already on it and skipping around as needed.
Am I wrong about the MPMoviePlayerController not supporting non-fullscreen video? Is their an easier solution than making UIImageView flip-books? Is cutting around a video a performance hazard?
I think you're stuck with flip books. Pretty sure the fullscreen video issue is a limitation of the hardware video decoder.
After researching for about 1 hour, I didn't find anything. It appears impossible to play video non-fullscreen on the iPhone. I didn't check for openGL ES though.
well.. i have been looking for and haven't found the alternate yet!
But there are some applications already does it!
check TVUlite from TVUNetworks
As I mentioned in another reply, this blog post http://www.nightirion.com/2010/01/scaling-a-movie-on-the-iphone/ mentions a method that will allow you to play non-fullscreen video. However, I'm not sure if this method will be approved by the app store verification process.