Remix.run Logo
jack_pp 4 days ago

The way I imagined it you wouldn't know where the ad is, they can insert it on the fly at any point. It wouldn't count in the video seek bar.. at any random point they want they can just insert it and you can do nothing about it except mute it and wait it out.

Etherlord87 3 days ago | parent [-]

In such case take the worst (maybe disregarding 20% worst) ad length, and open a copy of the video advanced by that length. As soon as the ad starts to play, switch to the copy of the video. Of course you could be unlucky and the copy could get the ad at the different video time but same playback time. You could decrease the chance of it happening by additional copies, but the ads take small enough percentage of the time for 3-4 copies to make it very rare for such an overlap to happen.

Edit: actually, you could make a double buffer, so if you assume the ad takes up to 10 s, the copy of your video can skip 20 first seconds, play, eventually play an ad if it happens first on that copy, continue playing, and as soon as the main video get an add, go back on the copy to the right spot. So in order for this to fail, with just one copy, you need to either get an ad during the first 10 seconds, or the ad has to start exactly (within the lag time of let's say 50-200 ms) at the same time on both copies.