iOS - Playing a YouTube video in fullscreen from a table cell - ios

I'm trying to present a youtube playlist in a table (using YouTube Data v3), where each video should be opened in fullscreen (landscape) when the user taps on the cell.
How could I achieve it?
First attempt:
each table cell contains the title of the video and a small web view containing the iframe of the video; in this scenario if the user taps on the thumbnail, as it is a web view, the video automatically plays in fullscreen. The problem in this case is that the entire cell is not tappable but only the thumbnail.
Second attempt:
the cell contains an image with the thumbnail of the video (no web view) and the title. On the tap a new view controller with a fullscreen web view is pushed. The problem here is that there is an intermediate step that I'd like to skip.
The perfect result would be exactly what the YouTube app does: in the video result list, when you tap on a cell, the video opens and automatically starts; but differently from this case I need it to be opened in fullscreen.
Thanks a lot for any hint,
DAN

go with first Attemp, but minor modification,
If the user clicks on the cell reload the webview with change in iframe html code making it autoPlay.How to autoplay a YouTube video in a UIWebView

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 play a central video from the list when scrolling stops

I've made the iOS app (using Swift), which fetches videos from the website and displays them in the list(displays videos' thumbnails to be precise).
I'm using Table View and fill out a Prototype Cell with the data from the website. It gives me a scrolling effect.
When the user clicks on the thumbnail it brings him to the page with a webView where the video can be played.
Could you please give me a reference to videos/articles or explain based on your own experience how to play a central video from the list when it stops scrolling.
Thanks a lot for your help!

Controlling/Handling embedded youtube video in long UIWebview content iOS 9

I have UIWebviews that contains different styled texts, images, youtube videos etc. If UIWebview has Youtube video, it has Picture-In-Picture button as default (I have PiP feature in app for my video gallery with AVPictureInPictureController, means PiP enabled in app).
1) How can I opt-out for PiP for those embedded youtube videos
Another case is my UIWebviews are in UICollectionViewCells, that is in horizontal mode, 1 cell per page, paging enabled, I can't pause the youtube video when change page to another, because I have no variable or something that assigned to that player to control player. This case arises in iPad, because in iPhone when you try to play embedded youtube video it goes for full screen, to change another cell you have to press Done(that pauses video) so video handles itself to stop, but in iPad it plays in UIWebview autmatically, doesn't goes for fullscreen
2) How can I get controll on embedded youtube video in my UIWebview
Found solution for #1:
myWebiew.allowsPictureInPictureMediaPlayback = false

UIViewController's view has weird 20px

Hello Guys I am facing a wierd behaviour in my app the case is like this :
From view controller(A) present another view controller (B) which has a UIWebView that will open an URL, but sometime the URL is Video link,
Sot he video starts playing in full screen and when finish and tap on Done (Dismiss Video player) and then dismiss the Controller (B) a weird 20px appeared at the bottom of view controller(A) and the whole app will lose the 20px in all screens.
Any one has idea for what is happening, I am certain sure that it caused by playing video through UIWebView
Update 1 :
I just figured out that this could be related to the iOS itself when playing videos whether from video file or from video url (since both will be played using the same player).
My experiment was on Facebook app when I post the same links used in my app inside Facebook app then try to play the videos from the links and the behaviour showed !
I wish if could someone help to confirm if playing videos causing problems on the UI.

Youtube video in a UIWebView with small frame

In my app I'm supposed to make a menu where users can play a video from a list. The list is presented in a horizontal UIScrollView and I have a frame of 120x80 (in points, in pixels it's 240:160 on retina). The links for videos are either youtube urls or addresses of .m3u8 files on our server (I put them in a simple html from apple's http live streaming documentation).
My problem is with the youtube urls. These pages opened in UIWebView always have a bar on top that limits the tappable surface to half. Also when I play the video for first time another bar shows up (for like, dislike and things like that), which limits the space that will launch the video on tap to 0.
My goal here is to have the videos represented by images (UIImageViews) with buttons on top of them in shape of the "Play" triangle. When I press that UIButton, the video should show, as normal, inside an MPMovieController.
So I need 1 of 2 things:
Have the UIWebView show just the video of the youtube page, without the bars.
Make the youtube video show inside an MPMovieController after user taps a UIButton.
Any tips on how to do either of these?
Yes you can do like this and you need use set property on UIWebView.look this example
here

Resources