How to rotate a player view like what Youtube app does - ios

Here is my app:
Screen record
But the animation is autorotation default. It's not looking very smooth. I want my video player rotate and expend to whole screen like what Youtube iOS app does. How to do that? Any suggestion?
Actually it seems only the video player view is rotated and expanded to full screen for Youtube App. But the whole view of UIViewController is rotated in my case.

Related

Play the video in two view controllers from where the previous video stopped

I have a table view controller that has a video view in each cell.
Each cell has a play button, slider and a full screen button.
I have implemented logic for playing , pausing and seeking the video using AVPlayerLayer.
When I click on the full screen button I am moving to another view controller where I will play the video in full screen in portrait and landscape mode
When I move to the full screen controller I want the video to play from where it was playing in the previous view controller.
And when I move back to the previous view controller the video should play from where it played in the full screen controller.
How can I achieve this? Any help will be appreciated. Thank you
I have implemented same for an audio player which has a mini player and tapping on it will open in full screen.
I have detached audio player from UI. Created singleton class of player which will update UI. So there will be only one instance of player which will update multiple UI in sync.
You can implement same logic for your player.

how to show split view in landscape only in IPhone using swift

i have video player on the top and there is tableview below the video player. video player has some custom control UI and below in the table view there are some cardview shows video list.
but when the video playback will end then in portrait its showing video view on top and bottom will show tableview. in landscape i want to show two view. left side will show video end playback UI and right side will show the tableview .
i want to show like this
If you are using Xcode 8.2 and swift3, in the Main.storyboard you have the option where you can see your application with the different Orientation and Device.
You can adapt the view with the orientation that you choose. Like below:
Here a great tutorial about Auto Layout with Xcode8.
Hope that helps,

Layout Constraints Only Applied In Certain Conditions When Size Class Changes

I have a container view controller which contains 2 views. One is a video and the other is chat. In portrait mode, the user can see both the video and the chat; however, in landscape, I want it to only show the video.
What I've done:
I use size classes and for wCompact and hCompact (iPhone 6 landscape), I remove the chat view and update the constraints. It 'partially' works.
If I start my application in landscape, the video will be shown in full. When I rotate to portrait, I get both the video and chat views. Finally, if I rotate it back to landscape, I only get the video view again. This is the desired behavior. See this GIF:
The problem:
If I start the app in portrait, it shows both the video and chat view. Then, when I rotate it to landscape, the chat view is removed but the video view does not update to its new layout constraints. See the GIF below:
I suspect this has something to do with the view using a MPMoviePlayerController or the fact that it's fetching/streaming data. I don't know.
I'm not even sure what to google to help with this so if anyone has anything, please let me know.
Thanks much!
Solution: Use AVPlayerViewController and AVPlayer. It just works. MPMoviePlayerController is buggy

how to fix youtube video in uiwebview from playing behind parent view controller

I have implemented TTPhotoViewController in my app and it is working fine. However, it seems to have broken the landscape orientation on the the only view controller that rotates in my tabbarcontroller (subclassed). I have also returned NO in - (BOOL)shouldAutorotateToInterfaceOrientation: in my subclassed TTphotoviewcontroller and TTThumbviewcontrollers to stop landscape orientation of the photo gallery.
The view controller that previously was able to orientate to landscape plays youtube videos. The view controller loads a list of videos (youtube mobile page) but now when you select a video to play the file plays in the iOS movieplayer in landscape (which is a good thing) but BEHIND the parent view controller which remains in portrait.
I have removed the code to force the video view controller to orientate to landscape and the behaviour persists, which makes me think it is something to do with a file in the Three20 library.
Any ideas?

iPad embedded YouTube video player stays in fullscreen after stopping it programatically

I have a UIWebView that loads a YouTube video.
The problem is, that if the video is playing in full screen and I reload the web view to "about:blank" to stop the video, the video player remains as the top view in the window's view hierarchy and blocks everything.
Only the black video player remains visible.
Has someone encountered this issue?
Thanks.
I have the same problem.
Using the old embed code ( http://iphoneincubator.com/blog/audio-video/how-to-play-youtube-videos-within-an-application) causes this problem for me. Similarly, the video does not rotate into landscape mode.
I've switched over to the beta code at http://apiblog.youtube.com/2010/07/new-way-to-embed-youtube-videos.html. Seems to work.
The inability to switch to landscape during playback is still there though.

Resources