Scroll Through Videos in TableView

I am trying to make an instagram feed of only videos. Right now I am playing videos as soon as the center of the cell is visible. When I scroll even a little (staying on the same cell) it checks again if the center is visible and so the video pauses and gets reloaded. i want it to be like instagram how the video does not pause until it goes off screen.
I tried celldidEnddisplay however I just want that when the center of the cells goes off screen. and the next cell’s center comes on screen.

func tableView( tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {

if let mycell = cell as? HomeTableViewCell {
mycell.cellIndex = indexPath
playvideo(cell: mycell)
}

}

func scrollViewDidEndDecelerating(
scrollView: UIScrollView) {
self.player.pause()
}

func scrollViewDidEndDragging( scrollView: UIScrollView, willDecelerate decelerate: Bool) {
if !decelerate {
self.player.pause()
}
}

func scrollViewDidScroll(
scrollView: UIScrollView) {
let cell = HomeTableView.visibleCells
for everycell in cell {
playvideo(cell: everycell)

}
}


func playvideo(cell : UITableViewCell) {
if let mycell = cell as? HomeTableViewCell {
let cellPoint = mycell.center
//let cellRect = HomeTableView.rectForRow(at: mycell.cellIndex!)
if HomeTableView.bounds.contains(cellPoint) {
//let completelyVisible = HomeTableView.bounds.contains(cellRect)
//if completelyVisible {
let timer = Timer.scheduledTimer(withTimeInterval: 1.3, repeats: false) { (timer) in
self.player = AVPlayer(url: mycell.videoURL!)
self.avpController.player = self.player
self.avpController.view.frame.size.height = mycell.containerView.frame.size.height
self.avpController.view.frame.size.width = mycell.containerView.frame.size.width
mycell.containerView.addSubview(self.avpController.view)
mycell.containerView.sendSubviewToBack(mycell.VideoImage)
mycell.contentView.bringSubviewToFront(mycell.containerView)
self.player.play()
}
} else if self.player != nil {
self.player.pause()
}

}
}
Scroll Through Videos in TableView
 
 
Q