Play Vine-style videos in iOS

I am looking for a vine-style video playback control for iOS. Meaning, as soon as the video contained in the tableviewcell appears, it automatically plays without the annoying separate modal pop-up on the iPhone. Is there something similar already or should I encode it myself?

thank

+4
source share
1 answer

You will have to encode it yourself. I realized this just a few days ago, and it was a little painful. First, I made sure that each video is the height of the screen, except for the next (the height of the table cell should be the height of the screen). Then, in my autoplay method, I look through all the visible cells and check if the bottom left point is for the frame for the video player. If so, then play the video in this cell. Here is a sample code. The annoying thing that may be required for tuning is point detection.

UPDATE: Removed the old code that was a glitch. The instructions for the new implementation work much better.

First, keep track of the cells that play with the mutable array: playCells

Here is the gist of my autoplay method:

  • loop through visible table cells
  • , , AVPlayerLayer.
  • :
    , , ( )
    (ivar), ,

    , .

:

  • playCells
  • ( ), AVPlayerLayer AVPlayer nil
+1

Source: https://habr.com/ru/post/1540304/


All Articles