VIMVideoPlayer icon indicating copy to clipboard operation
VIMVideoPlayer copied to clipboard

Recommended usage in UITableView

Open ebalassanian opened this issue 8 years ago • 2 comments

What is the recommended usage for showing videos in UITableViews where multiple cells can have video shown in them? In my case, only one video should be playing at a given time. Is it better to associate a VIMVideoPlayer per cell or to have one VIMVideoPlayer associated with the UITableView that reset it's URL based on the UITableViewCell?

ebalassanian avatar Mar 07 '16 16:03 ebalassanian

You could obtain a reference to an VIMVideoPlayer ivar self.currentPlayer, then when any subsequent video is triggered to play, you can call [self.currentPlayer pause] or [self.currentPlayer reset] from within the method that triggers the next video and reassign self.currentPlayer = newPlayerFromCell.

Also, make sure you properly override - prepareForReuse in your UITableViewCell subclass.

cameronehrlich avatar Mar 08 '16 02:03 cameronehrlich

A follow up question to this... is there a best practice to preload videos so when cells are visible the video does not have to wait for buffering to playback? e.g. is there a way to have the vimplayer preload the data for playback?

ebalassanian avatar Oct 26 '16 17:10 ebalassanian