Skip to main content

How to build something like a Youtube advertisement system

Rails • Asked by Darren Booker

Hi Chris,

I am pretty sure they have a complex system implmented but at the basics of it, how could you go about implementing an autoplay advertise video before the actual video itself starts to play just like youtube? Never seen it done in a rails application. I created a clone youtube application for the fun of it and want to take it up a knotch a bit.

Is there third party service for advertisement you can implement?


You'd just need to find a video player that will do it for you (that way you don't have to build it yourself).

https://www.jwplayer.com/video-ad-support/
https://cloudinary.com/product_updates/video_player_ads

There are several other options.

If you wanted to build it yourself, you'd first play the ad, then when it is finished, replace the video with your content. All that will probably be in Javascript and you'd need videos for the ads and such to serve up. And you'd want to collect ad metrics for plays and clicks, etc probably.


Perfect.

JWPLAYER is exactly what I was looking for. Chris one more question. Rails uses the standard video_tag to actually render the video. Is there a way to count views like youtube. I know jwplayer might have the feature but if I wanted to do it from scratch, how would you go about implmenting this feature?

Thanks!


Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 22,346+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.