In many video websites, before the real video starts, the website shows a short advertisement video. After this video finishes, the real video starts playing.

There are some examples here:
http://www.cbsnews.com/video/watch/?id=50139192n

Is there a way to have this kind of workflow?