I want to remove/hide the full screen button from MPMoviePlayerController
standard controls as full screen mode is creating lot of problems and also not a requirement of my app.I just want the play
,stop
,forward
,reverse
controls
. Can anybody help me?
1 Answers
There's no standard way to do this. Here are your options.
You could set the MPMoviePlayerController's
controlStyle to None and create your own custom controls. Cons: this is a lot of work.
You could use the NSNotificationCenter
to intercept the MPMoviePlayerWillEnterFullscreenNotification
and immediately set fullScreen mode to NO. Cons: based on the iOS version of the user, this may cause a flicker or some glitchy effect.
You could go through the MPMoviePlayerController
view's subviews until you get to a MPInlineTransportControls
view which contains the controls, the slider
and the play/pause button
and the full screen button which are all of class MPTransportButton
. Find that one and you can hide it or remove it from its superview. Cons: as of right now this passes app store reviews and works perfectly on all currently supported iOS
versions. But this could change at any time. If Apple decides to redo their default video player you may end up with non working code.
-
in iOS 6 can't find MPInlineTransportControls view. – Van Du Tran Mar 20 '13 at 15:15
-
2This answer was very helpful, if you're using the `NSNotificationCenter` method it's a bit wrong. You should listen for `MPMoviePlayerDidEnterFullscreenNotification` and not `MPMoviePlayerWillEnterFullscreenNotification`. If you listen for `Will` instead of `Did` you will set the `fullscreen` property to `NO` before it's set to `YES` and the method will not work. I also found a bug where the video disappears but continues to play after you call `setFullScreen:NO`. To prevent this, I called `[video pause];` and then `[video play]` after my `setFullScreen` method. – bergy Jan 07 '14 at 06:20
-
By iterating all MPMoviePlayerController subviews http://stackoverflow.com/a/27482687/928599 – mohsinj Oct 15 '15 at 10:18