Cloudinary Blog

Building Display Ads With Transparent Video

Build Web Ads With Transparent Video to Attract User Engagement

Billions of views on the Internet every day drive one of the biggest industries on the planet: advertising. The sheer size of that market and the competitive nature of vying for consumer attention results in a constant need for innovation. Readers are jaded, and display ads are blind spots.

To break through this veil of antipathy, advertisers must impress, entertain, and delight prospective customers. Reality is, click-through rates for static banners are continuing to drop, and even animated images or script-based animations are limited in effectiveness. Motion captures readers’ eye, but a story holds the audience, hence why more advertisers are moving toward video-based advertising.

However, if placed outside the main field of view, video and video APIs are still subject to the "blind spot" issue. Overlaying a video that contains transparency enables the video and, therefore, the message to become part of the content.

Placing a video overlay on top of your site’s viewport, changing content, or helping visitors navigate the site promotes understanding of your product, encouraging engagement by potential customers. Transparent video feels like it’s part of your site, not just embedded there. Since all other webpage elements are visible, you can, with regular web-development expertise, build a captivating experience behind and around videos.

With the power of today’s 5G bandwidth, streaming video on websites is no longer a challenge, so you need not limit yourself to the old-fashioned, text-based ways of implementing interactions. With Cloudinary and a little JavaScript, creating compelling video ads is now easier—and more fun—than you might think.

Preparing the Video

Transparent video ads originate from videos with a transparent channel, such as WebM videos, and a transparent background set. You can purchase videos in that format online or create your own green-screen videos and remove the background. That’s what we did for this demo: we downloaded a video from Camtasia and then used that tool to eliminate the background. The video is available for free for those who want to process videos with Camtasia.

Note
Cloudinary is working on an experimental feature to “automagically” remove video backgrounds.

Once you have a WebM-formatted video with a transparent background, upload the video to Cloudinary:

  1. Log in to Cloudinary and, on the Dashboard, click the Media Library icon (second left at the top).
  2. Click Upload in the top-right corner to specify the video you wish to upload. Either drag and drop it on to the portal or select it after navigating to the folder that houses the video. Once upload succeeds, Cloudinary displays it in your Media Library:
  3. Copy the video URL and embed it on your website with the built-in HTML5 <video/> element. Before doing that, feel free to apply more transformations to the video, such as resizing, cropping, and adding a background.

Your video is now available on your site. Read on to learn how to stream video content to visitors.

Embedding the Video on a Website

Cloudinary offers an SDK that delivers transparent videos directly within HTML content. With that JavaScript SDK, you can deliver content across all browsers. The rest of this section describes the controls for delivering transparent video to all browsers.

Normally, you would add video to webpages with the HTML5 <video> element or through the Cloudinary Video Player. However, transparent video is an exception. Native HTML5 and the Cloudinary Video Player can handle transparent video everywhere except Safari on iOS and pre-Big Sur MacOS versions. That’s a problem given the ubiquity of Macs and iPhones.

Fortunately, the Cloudinary JavaScript SDK can help with its injectTransparentVideoElement method, which can add transparent videos that work everywhere. Here’s an example of the code on a simple webpage:

Copy to clipboard
<html lang="en">
    <head>
       <title>Transparent Video</title>
       <style>
            #video-overlay {
                position: absolute;
                top: 90;
                left: 65;
                width: 900px;
            }
       </style>
       <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
       <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap-theme.min.css">
       <script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
       <script src="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
          <script src="https://unpkg.com/cloudinary-core@latest/cloudinary-core-shrinkwrap.min.js" type="text/javascript"></script>
    </head>
    <body>
       <div class="container">
            <h1>Video overlays</h1>
            <p>Video overlays are a great way to engage users without interfering with the content on the website.</p>
            <input type="submit" value="Click me!" class="overlay-control" style="z-index: 6; position: relative;" />
            <p>Hi, here is some text behind the video...</p>
            <p class="mt-100">Here is more text content.</p>
            <div id="video-overlay" style="z-index: 5;"></video>
       </div>
          <script>
              $(function() {
                $(".overlay-control").click(function() {
                    var cld = cloudinary.Cloudinary.new({ cloud_name: 'afzaalahmadzeeshan' });
                    cld.injectTransparentVideoElement(document.getElementById("video-overlay"), 'v1610035527/samples/elephants.mp4', {
                        loop: true,
                        playsinline: true,
                        width: 600,
                    }).catch(error => {
                        console.log(error);
                    });
                });
              });
          </script>
    </body>
</html>

As expected, you can see the HTML elements behind the video because of its transparent parts.

Furthermore, you can create fun experiences with transparent video, for example, set up the content with JavaScript to play or pause on a user interaction, hence opening up more possibilities for content and advertising. A transparent-display ad can become part of the content the audience was looking at, intriguing them and capturing their attention. On your website, transparent video can also entice audience engagement with content, directing them to navigate to product pages or interact with demos.

Applications abound for transparent video in other industries. For instance, those in academia can display videos that require students to perform certain tasks on the website before the instructor proceeds with the course material.

Keep in mind that you can further customize the above script to transform videos. Plus, it’d be prudent to add a fallback value that the script can render in case the browser does not support all the features required to play the video.

For details on all those options, see Cloudinary’s documentation on its Video Player and on video transformations.

Taking the Next Steps

Beside describing the benefits of embellishing web advertisements with compelling, transparent video content, this article also explains why interactive content is useful and why old, static ads are less so. You’ve also learned how to collect, purchase, or prepare your own interactive video for display on your site, and then embed that video with Cloudinary and JavaScript.

Cloudinary’s upcoming video-editing feature will build on the existing technologies, enabling you to create riveting, interactive videos with artificial intelligence (AI). You can then easily remove video backgrounds and create transparent overlays for embedding in your website, further promoting user engagement.

For more insight, check out the Google Chrome Developer’s post on alpha transparency in videos and the Google Web Team’s article on autoplay policy changes.

Are you ready to boost engagement with transparent video ads? Start with signing up for a free Cloudinary account with enough credits to create your first sleek ad.

About the Author

Afzaal Ahmad Zeeshan, who hails from the Netherlands, is a developer advocate at Adyen with a preference for .NET Core and Node.js for everyday software programming. As an expert on cloud, mobile, and APIs, Afzaal is adept with the Azure platform and enjoys building cross-platform libraries and software with .NET Core. He’s also an author with Pluralsight with a focus on producing courses on mobile development and programming languages.

Additionally, Afzaal is an Alibaba Cloud MVP. He’s been named Microsoft MVP twice for community leadership in software development, CodeProject MVP six times for technical writing and mentoring, and C# Corner MVP four times in the same field. Beyond that, Afzaal is an active open-source contributor (user name afzaal-ahmad-zeeshan) on GitHub and GitLab.

Recent Blog Posts

Shoppable Video Is Becoming Popular in E-Commerce

As pandemic restrictions necessitated, many shopping trips in 2020 took place outside the traditional brick-and-mortar store, or at least void of the physical aisle-browsing experience. Same-day curbside pickup became a safe and convenient alternative, and e-commerce transactions skyrocketed as consumers shopped online. In fact, Digital Commerce 360 estimates that, compared to 2019, e-commerce transactions grew by more than 40% last year.

Read more
Enhance Your Travel Site With Cloudinary in Anticipation of a Return to New Normal

Read more
The Benefits of Headless DAMs

Headless is not a buzzword anymore. In fact, the concept of headless architecture is gaining momentum due to the flexibility it offers for composing new experiences and for tackling the undue complexity of an ever-evolving technology stack. That’s because while the evolution of the martech landscape has enabled disruptive, digital innovations, the approach of buying point solutions for solving specific challenges can expose companies to the complicated nature of new technologies, systems, and platforms.

Read more
How Cloudinary's Media Optimizer Helps E-Businesses Deliver Superior Web Performance

As a technology company, Cloudinary owes its success to its ability to build solutions that address the most critical challenges you, our customers, face. The companies we serve run the gamut of digital businesses—retailers and direct-to-consumer brands, media and entertainment, travel and hospitality—which, coincidentally, all care about the same things.

Read more