We are trying to achieve the same effect as within the Facebook app regarding tapping on a video in the feed and transitioning the same video at the same time to a modal view.
How do you transition an AVplayer from a uitableviewcell to a new instance of a uiviewcontroller seamlessly?
I achieved this by implemnting the UIViewControllerTransitioningDelegate
and using my own custom animator object, which conforms to the UIViewControllerAnimatedTransitioning
protocol.
I used https://github.com/recruit-mp/RMPZoomTransitionAnimator as a reference, with a few modifications to move an actual view (not a snapshot) between source and destination UIViewControllers
:
Within the animator object, using the animator object's delegate methods for "source frame" and "destiation frame" and "playerView", all which are implemented on the "to" and "from" view controllers, I grab the view containing the playing video, grab it's start frame, it's end frame, and properly animate the view from its start frame to the frame it will end up being located at on the "to" view controller.
Upon completion of the transition, I then add the playing video UIView
as a subview to the destination view controller, so that it becomes part of the "to" view controller's view, available for interacting with, etc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With