ahmetws / swifttube

iOS conference videos in one place
169 stars 17 forks source link

Adding random video endpoint #12

Closed jstashh closed 5 years ago

jstashh commented 5 years ago

For #6. I have a hunch that getRandomVideo() might be terribly inefficient. Should I be getting a list of video ids or equivalent and then get the video rather than always getting all the videos getVideos() or does it not make much difference?

Also haven't added a button to call the endpoint, not sure where you wanted it. Top right?

ahmetws commented 5 years ago

As you said, using getVideos() is not so efficient in here. Instead of this, you can get random data using

AggregationPipeline.Stage.sample(sizeOf:1)

Check out getFeaturedVideos() inside APIClient class. You can use the same approach to get a random video, just by deleting the match stage.

I think it is better to just add a link to the footer for now and check if people using this page or not. What do you think?

jstashh commented 5 years ago

@ahmetws thanks for the tips, yes I think the footer is suitable