I am loading my AVPlayerController on a specified UIView. Is there a way to hide only the fullscreen button shown on the AVPlayerController?
What you can do is hide all the controls using:
YourAVPlayerViewControllerName.showsPlaybackControls = false
and then create your own custom controls for the player
EDIT:
Also as mentioned in the comments, you cannot remove only one button, if you need the excat the same then you need to customise your view based on your requirment
I'm afraid you cant, but you can create a customized player using AVPlayerLayer then you can do almost anything you want in it but you need to handle everything manually, slider and playback Controls and so.
there are already lots of tutorials on how to achieve that like this one
Related
I want to add my own custom dropdown when a video is playing and the user swipes down. However, the default dropdown with asset info and audio settings always shows first when I swipe. I know I can get rid of it by making the video not be fullscreen, but then I would lose playback controls.
Any help would be greatly appreciated, thanks!
Update
let swipeDownGR = UISwipeGestureRecognizer(target: self, action: #selector(self.handleSwipes(sender:)))
swipeDownGR.direction = .down
view.addGestureRecognizer(swipeDownGR)
The default dropdown usually captures the gesture before my recognizer does.
I'm not too sure if you can get rid of some of the default behaviors that AVPlayerController provides. I actually would recommend creating your own custom playback controls (which isn't actually as hard as it sounds). All you have to do is to create a translucent UIView and overlay it on top of the AVPlayer, and add the elements that you want which gives you full control over the controls/elements that are there when the video is paused.
let vc: AVPlayerViewController = ... //your view controller
vc.playbackControlsIncludeInfoViews = false
I am getting all events of the player by this notification MPMoviePlayerPlaybackStateDidChange, but not getting the next/previous event/action.
Can we handle all actions with the Now playing info in the background of application with this player?
Please let me know.
Thanks
MPMoviePlayerController, post only MPMoviePlayerPlaybackStateDidChangeNotification even when stop, previous and next buttons are clicked. You cannot find directly which button is clicked.
For this you can create your own custom control with custom button actions, from this you can detect easily which button is clicked.
NOTE: Before creating the custom control you must set the player's controlStyle property to MPMovieControlStyleNone to hide the default controls.
I was following the advice from Scott Rogers in a previous posting "MPMoviePlayerViewController customization". I have a requirement to display only the 'DONE' button in the interface controls of MPMoviePlayerViewController. As I understand, it is not possible to access objects in the standard control, you can only set the control style - hence I have created a custom control myself with an xib file, with LAF as the standard only but with only a done button.
I have added the control view over the player thus:
self.vCtr.view.frame=CGRectMake(0, 20, self.window.frame.size.width, self.window.frame.size.height-20);
[self.mPlayer.view addSubview:self.vCtr.view];
and then faded it after a couple of seconds:
[self performSelector: #selector(fadeControl) withObject: nil afterDelay: 2.0];
However I'm unsure how to properly emulate the fade-out-after-2sec and fade-in-with user-click-on-video-window, and this is what I'd appreciate some help with please.
Should I:
fade the control to a very small alpha (0.1?) so I can capture a click in that view controller (I believe people have said this is not good)
fade the control to hidden, then create a transparent button the same size as the movie view that when clicked, fades in the custom control view again?
I think (2) is the recommended way to go, but if so could someone help with implementation? Should the button be between the custom control and the movie view in terms of hierarchy? Can I create it programmatically, and if so where do I define the event handler?
Thanks for any pointers (newbie iOS programmer)
I'm trying to build an app that uses page control as a main navigation. Here's how it goes i want to have full screen buttons that can be be swiped and when you click on them it takes you to the corresponding view. I know how to implement pagecontrol for images bu not for buttons any help would be much appreciated.
This sounds like a terrible design, but assuming you have some great reason that I'm just not creative enough to imagine, you don't need to use buttons, you can use images and just add a UITapGestureRecognizer to them and trigger on that event. In effect, the entire view (image) will be a button.
is it possible to remove the little rotate icon in the UIImagePickerController that switches between the front & back cameras? This is for an app that won't goto the Apple Store, and it's only on one device. Anything i can do? I see that i can do this, but it removes the record button as well.
cameraUI.showsCameraControls = NO;
Unfortunately not, there is no direct way to turn off 1 particular camera control.
What you could do, is to do the following:
// Create a view that recreates the camera control functions you need.
// Your view will need to be able to set the following properties on camera UI
// cameraCaptureMode, cameraFlashMode (NOT cameraDevice, which is the control you want to disappear)
UIView* customOverlay = [..way to create your custom overlay..];
cameraUI.showsCameraControls = NO;
cameraUI.cameraOverlayView = customOverlay;
If you need to know how to create a custom overlay, it may be worth raising as another question.
its all or nothing when it comes to showsCameraControls. You need to either set showsCameraControls to NO and create your own cameraOverlay view, or roll your own camera using AVFoundation where again you'd need to create your own camera controls.