我连续几张桌子上有几个视频.
问题是它们是同步播放的.在屏幕上1video,并2video播放同步
如何在桌面视图上跟踪焦点单元格cell.player?.play().和其他细胞cell.player?.pause()
我的代码:
class MyViewController
//don't work
func tableView(_ tableView: UITableView, didEndDisplaying cell: UITableViewCell, forRowAt indexPath: IndexPath) {
if let cell = tableView.cellForRow(at: indexPath) as? ListViewCell {
cell.player?.pause()
}
}
//don't call
func tableView(_ tableView: UITableView, didUpdateFocusIn context: UITableViewFocusUpdateContext, with coordinator: UIFocusAnimationCoordinator) {
print("table view cell didUpdateFocusIn")
}
class MyTableviewCell
override func prepareForReuse() {
super.prepareForReuse()
player?.pause()
}
Run Code Online (Sandbox Code Playgroud)