CHARLOTTE—Companies don't usually complain when their advertisements reach a wider audience, but some companies are doing just that after their ads were played before Islamic State propaganda videos on YouTube.

The self-proclaimed Islamic State has been known for their web-savvy, even claiming responsibility for a recent surge of hackings at U.S.-owned small businesses.

Ads for major companies regularly play before YouTube videos. YouTube has a formula for playing ads randomly before videos, and usually, it helps companies reach a wider audience. But CNN caught ads for Procter & Gamble, Anheuser-Busch and Aveeno products playing before an ISIS propaganda video.

“It's obviously a massively unfortunate situation. It's a situation no company would ever want to be in. But it's a little bit endemic of how people are buying media these days,” said Jared Meisel, managing partner at Theory House, a Charlotte-based retail brand management firm.

Meisel said companies buy ad space for the customer they're trying to reach. Beyond that, it's pretty much out of their hands.

“You don't pick specific videos you want your content to run in front of,” he said.

Neither the companies nor YouTube can pick and choose.

“There's over 300 hours of content uploaded every single minute to YouTube. So it's physically impossible for them to monitor all the videos that are out there,” Meisel said.

That means companies can either not advertise, or run the risks and react.

“You can't just be passive in this situation. You can't play it like a victim. You have to acknowledge responsibility or acknowledge the issue and clearly try to course correct as quick as possible,” Meisel said.

That's exactly what companies are doing now.

In a statement, Procter & Gamble said, "Our ads should not have appeared, and we're working with YouTube to understand how it happened and to avoid it happening again."

YouTube has policies to take down offensive content, but they rely on users to report it. YouTube did not immediately respond to requests for comment.