'how to embed YouTube video in iOS UITableViewCell

I would like to embed YouTube videos in UITableViewCells of my iOS app.

first of all I config the youtube-ios-player package in my Podfile using this command: pod "youtube-ios-player-helper"

then I create a custom cell and add a YTPlayerView on each cell.

when I ran my app I found that the tableview stuck.So is there a better way to embed YouTube videos to my app.

thanks



Solution 1:[1]

Well after some research, I found a way that can make the tableview run fluently.

Try this url we will get a image:

https://img.youtube.com/vi/\(videoId)/0.jpg

I create a UIImageView on each cell. When the user clicks on the cell, I call the playVideo() method.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ouflak