I'm pretty new in ios programming. Please, help me to find native solution to get the same button in avplayer controller as it is in safari:
How to enable this button in right bottom corner and assign my action to it?
I couldn't find, how to change AVPLayerController controls. But I made custom player with my control panels, using container view and embedding AVPlayerController.
Related
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.
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;
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!
I have a requirement to pop up a small option-view on clicking bar button item, similar to this image.
How can I achieve this? Any tutorial or link is highly appreciated.
I'm not sure this is available on iPhone but I know that on iPad UIPopoverController it looks so.
Apple Documentation
You can find source code here to create PopoverController on iPhone !
You need to create an UIView and set for backgound you image. In this new view you can add UIButtons to let the user to select an option.
how to remove default done button of MPMovieController in iphone?
Try this,
http://iphoneincubator.com/blog/audio-video/how-to-play-youtube-videos-within-an-application
http://apiblog.youtube.com/2009/02/youtube-apis-iphone-cool-mobile-apps.html
You can't add it directly to the MPMoviePlayerController's view -- that's a private view and it can't be accessible.
If you want to add buttons, you need to create a transparent window over the top of everything and add the buttons to that.
Apple's MoviePlayer sample shows how to do this.