How can I remove all buttons(play,pause,fullscreen...) in a player view - like in all interactive magazines. so I could play video in page swipe or after some action?
Thanks
You should be able to remove the controls by setting the controlStyle property of MPMoviePlayerController to MPMovieControlStyleNone. Rest of it, although unclear, look possible using gestures attached to the view property.
Related
I have created instance of AVPlayer and playing content in it. I need to provide one option to show this movie in full screen. Does any other option present instead of creating instance of AVPlayerController and using native playback button options.
AVPlayer is containing only video view. Buttons and basically all the UI over the video are responsibility of developer.
So you need to do view controller that have view where AVPLayer will be embedded, and over it another views (like buttons, labels). And of course rig everything with constraints. When you tap "full screen" button, animate constraints so you resize your video. This is it.
Much simpler (considering lines of code that must be written) is to use AVPLayerViewController, but you loose possibility of custom UI. On other hand most of the logic is there. (except for support HLS EVENT type playlists that are not closed, there is a bug that will be fixed in iOS11)
Update:
Bug in AVPLayerViewController, regarding HLS EVENT type is fixed in iOS11.
I Need to play a video when the view load but, other code i have try to do the video player comes up. I want to play the video in the UIVIEW. Can someone please help!
You will need to use an AVPlayer, specifying an AVPlayerItem. This should allow you to use multiple AV items within a single view.
Basically, everything is explained here:
https://developer.apple.com/library/ios/documentation/AudioVideo/Conceptual/AVFoundationPG/Articles/02_Playback.html
Is there any way to hide only Next and Previous buttons in AVPlayer while playing a video
You can only either hide them all or show them all via the AVPlayerViewController showsPlaybackControls property, so what I would recommend doing is using an open source or third party library or framework that controls AVPlayer for you.
Such as what's suggested by this related question, which ultimately points to this GitHub project. You can then remove or hide the controls you don't want to be visible.
Alternatively, you could create your own controls that call into, and control, AVPlayer.
=> you can get notification when ply or pause and stop
when you got notification of play at that time you can hide both next and preivios button
I'm trying to figure out if it's possible to play an m4v file in the background with buttons that overlay ontop of the video? The video is basically an animation (no sound) but I need to be able to add additional navigation on top of the animation to bring in other calls in the app.
Is that possible to do? If so what is the call that would be required? I've tried hunting around but can't find an answer yet
You can use MPMoviePlayerController, set control style to none, and put your own buttons on top of it.
http://developer.apple.com/library/ios/#documentation/mediaplayer/reference/MPMoviePlayerController_Class/Reference/Reference.html
My iPad app has the option to play videos. I use the MPMoviePlayerViewController class to play my videos.
My question is: if I want to play the videos on an attached external monitor, how do I keep the playback controls on the iPad like YouTube does? If I add the view of the MPMoviePlayerViewController 's player to the external screen's hierarchy I can play the video fine, but I now have no control over it. Is there a way to move or duplicate the view where the controls lie and place it on a view which resides on the iPad?
I'm not aware of an officially supported way of pulling out the original UI in this way. The MPMoviePlayerViewController only exposes the MPMoviePlayerController object it uses via its moviePlayer property. The MPMoviePlayerController in turn only exposes view and backgroundView, which aren't helpful for such a purpose. You could in theory inspect the subviews of the movie player's main view, find the playback controls and try to move them to the other screen. I have a feeling this will not end well though, as they're anything but static. You also never know what will happen in later iOS versions, or if they'll let your hack on the app store. It's probably less trouble to just re-do the UI yourself.
Actually controlling the video playback programmatically is straightforward - the view controller's moviePlayer implements the MPMediaPlayback protocol.