Add multiple MPMoviePlayerController on UIScrollView? - iphone

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.

Related

Create interactive videos in iPad - An app for product demo

I would like to create videos that needs to run on an iPad native app. The app needs to show a demonstration of a product through iPad. It needs to be interactive as well. I know we can do these in Flash, since Flash is not supported in iPad what are my options?
I appreciate any guidelines or hints. Thank you in advance
The easiest way to create interactive videos for iOS is to use Apple's HTTP Live Streaming technology. You have to create a video, embed metadata, play it using MPMoviePlayerController or AVPlayerItem, and then display clickable areas in response to metadata notifications.
Metadata should contain coordinates for the element you are tracking, eg: a dress, and a identifier for the product. You overlay this info with a clickable subview that reveals more information about the product. There are several applications of this kind in iTunes, here is one.
Once you get a working product and weeks-time of videos, the most difficult part is to perform motion tracking with the less possible human interaction. One approach is to use Adobe After Effects, another is to code your own solution based on OpenCV.
Some ideas:
You could use an MPMoviePlayerController with no controls, on loop.
Here's a solution I thought of using interactive HTML popover's over the video:
You could have a data store (say an NSDictionary), with playback times as keys.
The values could then be a custom class, which includes all the necessary data for an interactive popover on the video.
Your custom class could look something like this
#interface InteractivePopover : NSObject
{
NSString *snippetTitle;
NSString *htmlData; // could include links etc.
CGPoint popoverDisplayPoint;
// other styling attributes etc.
}
Now, when a user taps the video, it pauses it at the next 'interactive' point (by looking for the next key after the current playback time), and displays (animates on) all the popups, which you set before to show off different parts of the product.
That class might be your data store, then you create another class to handling displaying, animating, controlling, sizing (etc) these interactive popovers. It would create a UIWebView for the HTML. It would also control direction, and indication of the source point for your popover.
This is clearly very expandable because you could put images, embedded content etc into the HTML for these interactive popovers.
Anyway, that's how I would do it.
Though flash will not run on ipad you can still create apps for it with flash cs5 .

display two different Video-Streams at the same time

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

How to Play Two Videos Simultaneously in a UIWebView

I'd like to play two videos at the same time from an HTML page in a UIWebView. By default any playing video is stopped when another is started. This happens even if the two videos live in different web views.
Is there a way to force continued play for the first video?
You can only play one at a time.
Not possible yet (Mar 15, 2017)
See ref. from Apple Developer website under section "Multiple Simultaneous Audio or Video Streams"
just make two webviews with interface builder or coding on the same window or view and then u can do differnt things with both of them ..
but u have to take two webviews on diffent side of screen ,u cant take one web view over another

iPhone playing video in custom view: Example Code Please?

I'm wanting to put together an application which plays video fullscreen with an interface overlaying it that basically chooses the video that is played underneath it (think 'Gym Babes' but nowhere near as risqé!). I don't wish to use private headers so MPMoviePlayerController is out of the question.
I've been digging through stackoverflow for a while and have come to the conclusion that I would need to use some sort of custom codec/video library that I assume would be written in C.
My question is basically has anyone had success doing this? And can anyone share any code, tutorials etc they can share?
You probably want to take a look at AVPlayerLayer: http://developer.apple.com/library/ios/documentation/AVFoundation/Reference/AVPlayerLayer_Class/Reference/Reference.html it gives you basic playback abilities with no (read fully customizable) interface…

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.