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,
Related
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.
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.
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
The MPMoviePlayerController working fine in iPad with iOS 5, initially the video starts by adding MPMoviePlayerController to subview of self at certain frame .Pressing full screen button on MPMoviePlayerController embedded controls displaying the movie in full screen,again tapping the button will bring the video back to the initial frame in iOS 5. But in iOS 6, the when I press full screen button to bring the video to initial frame, the video just gone out of screen. Looks like Apple has made some undocumented change to MPMoviePlayer class that is causing this weird behaviour. Anyone having the fix for this?
I have fixed this issue myself, in iOS 6, apple has made some undocumented changes to MPMoviePLayerController class, when you tap on full screen button, the viewWillDisappear and viewDidDisAppear gets called for both the controller launching MPMoviePLayerController and its ParentController.
In My Project (a pdf reader), I have a very complex view hierarchy, adding a reader in view Controller, then adding the readerPageContents buttons(image Gallery, video, link) to reader page and then playing video on video button tap.So it was calling the ViewWillDisappear and ViewDidDisappear when launching the video in full screen, and when when I press toggle screen button to bring the video to initial frame, the ViewWillAppear and ViewDidAppear of both controllers called again and I was creating the pdf page again in parent's controller viewDidAppear which was removing the video.
So easier fix it to avoid ViewDidDisappear and ViewWillDisappear gets called by setting some BOOL.
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?