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

Our $2B Valuation

By
Blackstone Growth Invests in Cloudinary

When we started our journey in 2012, we were looking to improve our lives as developers by making it easier for us to handle the arduous tasks of handling images and videos in our code. That initial line of developer code has evolved into a full suite of media experience solutions driven by a mission that gradually revealed itself over the course of the past 10 years: help companies unleash the full potential of their media to create the most engaging visual experiences.

Read more
Direct-to-Consumer E-Commerce Requires Compelling Visual Experiences

When brands like you adopt a direct–to-consumer (DTC) e-commerce approach with no involvement of retailers or marketplaces, you gain direct and timely insight into evolving shopping behaviors. Accordingly, you can accommodate shoppers’ preferences by continually adjusting your product offering and interspersing the shopping journey with moments of excitement and intrigue. Opportunities abound for you to cultivate engaging customer relationships.

Read more
Automatically Translating Videos for an International Audience

No matter your business focus—public service, B2B integration, recruitment—multimedia, in particular video, is remarkably effective in communicating with the audience. Before, making video accessible to diverse viewers involved tasks galore, such as eliciting the service of production studios to manually dub, transcribe, and add subtitles. Those operations were costly and slow, especially for globally destined content.

Read more
Cloudinary Helps Minted Manage Its Image-Generation Pipeline at Scale

Shoppers return time and again to Minted’s global online community of independent artists and designers because they know they can count on unique, statement-making products of the highest quality there. Concurrently, the visual imagery on Minted.com must do justice to the designs into which the creators have poured their hearts and souls. For Minted’s VP of Engineering David Lien, “Because we are a premium brand, we need to ensure that every single one of our product images matches the selected configuration exactly. For example, if you pick an 18x24 art print on blue canvas, we will show that exact combination on the hero images in the PDF.”

Read more
Highlights on ImageCon 2021 and a Preview of ImageCon 2022

New year, same trend! Visual media will continue to play a monumental role in driving online conversions. To keep up with visual-experience trends and best practices, Cloudinary holds an annual conference called ImageCon, a one-of-a-kind event that helps attendees create the most engaging visual experiences possible.

Read more