Using multiple AVPlayer in a tableview like instagram

后端 未结 1 1598

I\'m trying to implement an AVPlayer into each row of a tableview cell but I don\'t find any good documentation. I would like to have a timeline like Instagram but I have no

1条回答
  •  -上瘾入骨i
    2021-01-15 03:38

    I would recommend not having all of the cells contain players. There really isn't a reason to as you aren't going to be playing all of the cells on screen at the same time (indeed I hope that isn't the plan).

    Instead, I would have each of the cells contain only an image, preferably of the first frame or somewhere in the first few seconds of each video. Preferably you have these already but it is possible to grab these images from the videos (separate research topic...).

    Then, you could simply wait for the user to tap the cell (or a play button over the image) and then transition the contents of the cell to a player instead of the image (and stop any other cell from playing). This should look and work basically identically to players in all cells but requires less resource loading and allows better image caching.

    0 讨论(0)
提交回复
热议问题