AVPlayerViewController in Navigation Stack Possible? - ios

I am working on a production app and I need to use an instance of AVPlayerViewController to play videos.
I would like to have a show segue present the controller by pushing it onto the navigation stack. However, this leads to strange behavior, because the user can press the full-screen button on the bottom right corner.
In Full-screen mode, there is a Done button which will exit full screen mode, but half the time, when I press Done, all of the playback controls disappear except for the scrubber which cannot move. Since I am in a navigation controller, the screen and the player is still there, but the playback controls break sometimes. It seems like the AVPlayerViewController is designed only to be presented modally and automatically dismissed with the Done button.
I know that in the documentation and example code, the AVPlayerViewController is presented modally into Full Screen and the Done button automatically dismisses it for you. But is it possible to push an AVPlayerViewController onto the navigation stack, without that strange Done button behavior?

Related

iOS modal interactive dismissal freezes

I have created a UIPercentDriven Transition which modally presents a popover view containing a tableView. Then, following stack exchange posts such as this one: In iOS, how to drag down to dismiss a modal?, I added a panGestureRecognizer to control the dismissal of the modal view. Then, I attempted to add functionality so that the user can continue to swipe downward once the tableview has reached the top to trigger the percent driven transition.
Here is a link to the project on github:https://github.com/KaplanAlex/modalViewDismissal
This transition was based on moving the frame of the modal view off of the screen. I also created the transition by using snapshots (which is commented out in the github project) and have the same issues. For some reason, the interactive dismissal works well unless the user moves the modal view back up after starting the dismissal and then continues to swipe upward after the modal view has reached the top of the view, the entire application seems to freeze. It doesnt crash, but also doesnt respond to taps anywhere on the screen. Even cancel button cannot be pressed. Has anyone encountered this issue before? Thanks for the help.

Analog of setViewControllers:animated: in NavigatorIOS

I would like to pop a view from the navigation stack (login screen) and immediately push another view (home screen) with NavigatorIOS.
In iOS I would achieve this using UINavigationController setViewControllers:animated:.
I have tried navigator.replace, navigator.replaceAtIndex but that doesn't quite work - it does replace the view but he navigation bar is hidden on the pushed screen (my login screen has it hidden, which is defined in its route properties), and there is no transition animation.
Another option that I tried is using navigator.pop followed by navigator.push. It did result in an animated transition but the login screen was still on the navigation stack (it wasn't popped) and the back button was visible.
What is the proper way to do this with NavigatorIOS?

pop view controller with enabled/open keyboard in ios 8

i am trying to implement some chatroom-like view controller (e.g. Messages-app on iPhone), and i would like to keep the keyboard enabled/open when this (chatroom-like) view controller gets dismissed and therefore gets popped from the stack, BUT dismiss it together with the view, i.e. sliding it out of the screen together with the chatroom-view-controller.
For the desired effect, just open the Messages-app on the iPhone, go into one chatroom/conversation, set the focus on the input-textfield so that the keyboard comes up, but then go back to the last view without dismissing the keyboard.
I always get this weird animation that the chatroom-view (-controller) is sliding out of the screen to the right (which is desired), but the keyboard gets dismissed to the bottom of the screen...
Does anyone know what I am doing wrong? I have already tried it with so many versions, from become/resign first responder in all the different view will/did appears...
My assumption is that it could have something to do with my custom pan gesture recognizer for popping the chatroom-view-controller from the stack of the navigation controller, but neither the docs nor the web contain such issues...
you don't need to keep your keyboard visible, instead you can make snapshot of chatroom controller right before it being dismissed.
Edit: I just created simple app with navigation controller which pushed controller contains text field. Then on app tried to pop that controller when keyboard is visible. And..all view was dismissed together with keyboard, so your wanted behaviour is given by default.

MPMoviePlayerController fullscreen not working with adjusted VC hierarchy

We are setting up our app hierarchy dynamically so their is no persistent Tab/Nav view controllers, its dependent on the database content.
We have recently added a feature which opens a VC to allow the user to select which database (layout/content) to display however this has caused out video playback to break when in fullscreen.
Previously (and currently) we playback videos within a Nav Controller (in a Tab) with a custom control overlay. This all works fine.
On the control bar there is a fullscreen button which fires the MPC standard fullscreen mode. Previously it worked fine, but now the sound continues playing in the background but no movie is displayed or an overlaying layer - I can still see our tab bar, which is clickable.
Could this be something to do with the order of views on the window? If so how can I pick up the correct one to bring it forward?
You can bring any subview to forward [view_1 bringSubviewToFront:view_2];
We found out the problem....
It was that we weren't setting the window.rootViewController in the end to the new view controller, we were only adding its view to the windows subviews
This fixed both this (just after I had written a custom fullscreen mode) and also problems we were having with rotation

MPMoviePlayerController is hidden behind a modal UIViewController

On the iPad with iOS 4.3.
I've created a UIViewController.
I added a MPMoviePlayerController to the view controller, and loaded a movie.
I presented the UIViewController modally using UIModalPresentationFormSheet
I got what I wanted, a movie playing in a popup in the center of the screen..
But when I tap on the "enter full screen" button, the movie appears BEHIND the modal UIViewController. I'm left with a black square where the movie was. I can see the movie in the background, but I can't interact with it.
I am guessing that I either need to do something in the EnterFullScreen notification, but I don't know what. Or I need to do something completely different to show my movie in a popup. Something that isn't quite modal.

Resources