Embedded video in iPhone with smooth transition to MPMoviePlayerController - iphone

In the new American Idol app there are embedded videos that, if you tap them, start playing and showing "pause" and "augment" buttons. When you tap the augment button, you get an animation that smoothly launches the full screen MPMoviePlayerController. Do you know how did they make it?

I have implemented something like this by adding a gesture tap on that and implement the logic of the gesture. On a tap I have added a view with buttons like share (in my case). I am sorry I don't have that code anymore.

Related

control audio play in background

I have a tablewview and by click a table row a subview appear as player and play audio in my app . I added play in background mode and controls it while in background , it works .
The problem I have is , when I move to another view (exactly when the subview being disappear) I can't control or stop the audio.
how can I let the controls keep detect the audio playing while I'm in any other views of my app? also how can I let the subview appear when I back to my view again to allow stop or show the progress status?
I hope anybody can help
Please see the above link to find this solution and must read "Comment"... :)
Playing music in background ios app
another link may help you...iOS SDK : playing music on the background and switching views
You will have to keep a Strong reference to your view, or, at least, to your object currently playing a sound.
I'll suggest using a protocol between viewControllers to let the parent view controller catch the reference before dismissing the view containing the player.
You'll find much more explanation at Ray Wenderlich website's Audio playing tutorial.

customising MPMovieplayer

In my new app,I have to show videos in MPMovieplayer.Client gave me the design as in screenshot
I want to know whether it is possible to customize like this(including the top like,skip buttons and the custom slider)
If it is possible,help me to learn more about that
You can do it pretty easily with AV Foundation specifically AVPlayer class, it is the framwork underneath MPMoviePlayer. It will give you the options to have an abstract video/audio player and you'll be able to create you own customize UI
Here's an example code to start with AVPlayer
AVPlayer will work, but I hear it can be more complicated than working with a more higer level solution like MPMoviePlayer. I've been working on making my own customized UI for a video stream using MPMoviePlayer.
Whenever you create your MPMoviePlayer object, just set control style to none with: MPMovieControlStyleNone this leaves your video player ready for you to make customize controls. I suggest using a UIToolbar and then setting UIBarButtonItems onto your toolbar. Once your toolbar has all your buttons, add the toolbar to the subview with the addSubview method. You can then add functionality to the buttons and slider with the MPMediaPlayback Protocol with methods like play and pause. By the way, the top like and skip buttons could just be UIButtons which are pretty customizable. Lastly, if you want the controls to disappear on a tap then look into Gesture Recognizers.
Of course you can style your buttons and position your toolbar as needed, but this should get you a basic start.
Here's a custom class I wrote that works in iOS6 and newer.
https://github.com/busterbooth/bbMoviePlayer
You can control and re-skin just about every aspect of the MPMoviePlayer as long as you do the following.
MPMoviePlayerController *mp= [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:#"http://example.com/video.file"]];
mp.controlStyle = MPMovieControlStyleNone;

Custom UIButton in the modal screen of an embedded youtube video

When I embed a youtube video with a UIWebView, I get a 'Done' button when the video is brought up. The 'Done' button does not perform the way i want it to, how do I create my own 'Done' button?
You could overlay a view containing a button and anything else you want on top of the UIWebView and then connect things up as you see fit. You have to be careful about resizing on rotation and keep in mind that changes could be made to the you tube video presentation which are out of your control.
Solution to original problem: Use iframe embedding instead of flash embedding!

MPMoviePlayerController with a Custom Button on its toolbar

You might have seen video through you tube in iPhone.
Normal MPMoviePlayerController has previous, next & play/pause buttons.
You tube - player has additional two buttons on it.
=> Add to favorites on the left side.
=> Email this video on right side.
I want to implement the same for my application.
But I am failed to find out the property or methods regarding - implementing this.
How do I need buttons on it?
When User is watching video there should no buttons on screen.
When user taps on video - a toolbar comes on top & at center
A center tool bar has generally three buttons on it ,Previous - next -play/pause
I want to add a button beside next button & previous button.
I don't think you can modify the interface of an Apple provided view.
The general approach would be to play your video and then after it's done, show a view with the desired buttons/and or options for the user.
An example of this can be seen with the YouTube app on the iPhone. After the youtube video plays, the user is sent to a summary view with links to watch the video again, favourite it, share it, etc.
I would say that it may be possible to just set the MPMoviePlayerController's movieControlMode property to MPMovieControlModeHidden and add a subview to it with your own collection of buttons, titles, etc... But MPMoviePlayerController inherits only from NSObject, so you couldn't do that. Perhaps you can subclass MPMoviePlayerController and setup your own stuff when play is called, yet again, I imagine MPMoviePlayerController would display itself as a modal fullscreen view and hide anything you setup. :-\
If all you're looking to do is mess with the look of the controls, I DO know that you can mess around with various objects' drawRect: methods to override how bars and buttons are drawn.
For example, setting up a category or subclass of UINavigationBar and implementing drawRect: as follows will result in a custom navigation bar being drawn:
- ( void )drawRect:( CGRect )rect
{
[ [ UIImage imageNamed:kSTNavigationBarBackgroundImageName ] drawInRect:CGRectMake( 0.0, 0.0, self.frame.size.width, self.frame.size.height ) ];
}
This replaces Apple's standard look for their navigation bars and replaces it with a custom image asset. We do this, among other things, for our apps.

How Can I Implement Custom Previous/Next Buttons Over MPMovieplayer?

I have implemented a listing of videos in a UITableView. When I touch on a particular video then the video plays in an MPMovieplayer. Now, I want to make it so that if I touch on a next button, then the next video in the UITableView will play. How can I implement this?
Search for "MPMoviePlayer overlay" on stack overflow
Put an overlay over the movie with a previous and next button on it.
Make the buttons target methods that control MPMoviePlayer.