Using Open Cover Flow for video slides instead of images in iOS

Do you have the cover of multiple videos instead of images in iOS? The user will still see the beginning of each video using the play button instead of images like Youtube.

So, instead of a set of images, such as the current Cover Flow in iOS, it will be a set of videos. Or the videos and images are mixed up.

+6
source share
2 answers

iCarousel is the frame I would use in this case. This is the CoverFlow replacement library, since CoverFlow is an undocumented API in iOS. See the description on the GitHub website and read the note below.

Unlike many other CoverFlow libraries, iCarousel can work with any kind, not just images, so it is ideal for presenting paged data in a current and impressive way in your application.

I myself have not tried myself with video objects, but from the documentation and this, it would seem, you can transfer video objects or thumbnails that, when you click on them, download the video. Efficiency, sketching might make more sense. Below is the source code from the readme file with an explanation of how to use it.

iCarousel follows Apple's convention for data-driven views by providing two interface protocols, iCarouselDataSource and iCarouselDelegate. The iCarouselDataSource protocol has the following required methods (note: for Mac OS, replace NSView for UIView with method arguments):

- (NSUInteger)numberOfItemsInCarousel:(iCarousel *)carousel;

Returns the number of items (views) in the carousel.

- (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSUInteger)index reusingView:(UIView *)view;

Return the view that will be displayed at the specified index in the carousel. The reusingView argument works like a UIPickerView, where the views that were previously displayed in the carousel are returned back to the method to be processed. If this argument is zero, you can set its properties and return it instead of creating a new instance of the view, which will slightly improve performance. Unlike a UITableView, there is no reuse of an identifier to distinguish between different types of carousel views, so if your carousel contains several different types of views, you should simply ignore this parameter and return a new view each time the method is called. You must make sure that every time the carousel: viewForPageAtIndex: method is called, it either returns the reuse of the View or a new instance of the view, and does not support its own pool of processed views, since returning multiple copies of the same view for different carousel element indices can cause problems with carousel display.

So, for the second method, you can implement UIImageView , which was a thumbnail for the video, and reuse the view every time for each video. The surface of this is that you can mix images and videos, differing only when you need to display full screen image / video. And that would be as simple as requesting a class and then setting up another view to display based on the class. Is this enough information? Tell me if something is unclear.

+4
source

Why not use thumbnails to represent the video? When the image is clicked, the video is uploaded. This will force the application to use less processing power and will integrate with current iOS cap flow methods.

If you really want to make a video stream, you probably need to write code to create it from scratch. I would think that this is possible.

+4
source

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


All Articles