Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8980659
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T20:08:34+00:00 2026-06-15T20:08:34+00:00

Okay i have searched al over for a decent example on how to get

  • 0

Okay i have searched al over for a decent example on how to get the HTML 5 IMA SDK from Google working.

I have pasted my code below, all that happens is the HTML 5 video shows up that’s it no errors nothing. I don’t think the Javascript is even running and I know its because I messed something up. Please help. I just want to display ads into an HTML 5 vid

I have substituted my VAST tag for Googles example tag and used a generic video I found on the web for the src video. Anyone have a suggestion on why this doesnt work.

        <video id="videohtml5" width="720" height="405" controls="controls">
        <source src="http://www.cncpts.me/complex/html5-IMA/NewBalance_NYCExperience_FINAL.mp4" type="video/mp4">
              Your browser does not support the video tag.
        </video>
        <script type="text/javascript" src="http://www.google.com/jsapi"></script>
        <script type="text/javascript">
        var adsManager;
        var adsLoader;
        var clickTrackingOverlay = document.getElementById('clickTrackingOverlay');
        var videoElement = document.getElementById('videohtml5');   
        var adsLoader = new google.ima.AdsLoader();  

          // Add event listeners
        adsLoader.addEventListener(
            google.ima.AdsLoadedEvent.Type.ADS_LOADED,
            onAdsLoaded,
            false);
        adsLoader.addEventListener(
            google.ima.AdErrorEvent.Type.AD_ERROR,
            onAdError,
            false);

           // Create request object
           var adsRequest = {
              adTagUrl: "hhttp://pubads.g.doubleclick.net/gampad/ads?sz=400x300&iu=%2F6062%2Fiab_vast_samples&ciu_szs=300x250%2C728x90&impl=s&gdfp_req=1&env=vp&output=xml_vast2&unviewed_position_start=1&url=[referrer_url]&correlator=[timestamp]&cust_params=iab_vast_samples%3Dlinear",
              adType: "video"
            };

          // Make request
          adsLoader.requestAds(adsRequest);

          function onAdsLoaded(adsLoadedEvent) {
            // Get the ads manager
            adsManager = adsLoadedEvent.getAdsManager();
            adsManager.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR, onAdError);

            // Listen and respond to events which require you to pause/resume content
            adsManager.addEventListener(
                google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,
                onPauseRequested);
            adsManager.addEventListener(
                google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,
                onResumeRequested);

            // Set a visual element on which clicks should be tracked for video ads
            adsManager.setClickTrackingElement(clickTrackingOverlay);
            try {
              // Call play to start showing the ad.
              adsManager.play(videoElement);
            } catch (adError) {
              // An error may be thrown if there was a problem with the VAST response.
            }
          }

          function onAdError(adErrorEvent) {
            // Handle the error logging.
            console.log(adErrorEvent.getError());
          }

          function onPauseRequested() {
            videoElement.pause();
            // Setup UI for showing ads (e.g. display ad timer countdown,
            // disable seeking, etc.)
            // setupUIForAd();
          }

          function onResumeRequested() {
            // Setup UI back for showing content.
            // setupUIForContent();
            videoElement.play();
          }
        </script>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T20:08:35+00:00Added an answer on June 15, 2026 at 8:08 pm

    figured it out next task is to learn how to run this on an embed object inside an iframe

            <script type="text/javascript" src="http://www.google.com/jsapi"></script>
            <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
            <script type="text/javascript" src="http://www.google.com/uds?file=ima&v=1&nodependencyload=true"></script>
            <script type="text/javascript">
            $(document).ready(function(){
                $("#videohtml5").click(function(){   
            var adsManager;
            var clickTrackingOverlay = document.getElementById('clickTrackingOverlay');
            var videoElement = document.getElementById('videohtml5');   
            var adsLoader = new google.ima.AdsLoader();
    
              // Add event listeners
            adsLoader.addEventListener(
                google.ima.AdsLoadedEvent.Type.ADS_LOADED,
                onAdsLoaded,
                false);
            adsLoader.addEventListener(
                google.ima.AdErrorEvent.Type.AD_ERROR,
                onAdError,
                false);
    
               // Create request object
               var adsRequest = {
                  adTagUrl: "http://pubads.g.doubleclick.net/gampad/ads?sz=400x300&iu=%2F6062%2Fiab_vast_samples&ciu_szs=300x250%2C728x90&impl=s&gdfp_req=1&env=vp&output=xml_vast2&unviewed_position_start=1&url=[referrer_url]&correlator=[timestamp]&cust_params=iab_vast_samples%3Dlinear",
                  adType: "video"
                };
    
              // Make request
    
              adsLoader.requestAds(adsRequest);
    
    
              function onAdsLoaded(adsLoadedEvent) {
                // Get the ads manager
                adsManager = adsLoadedEvent.getAdsManager();
                adsManager.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR, onAdError);
    
                // Listen and respond to events which require you to pause/resume content
                adsManager.addEventListener(
                    google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,
                    onPauseRequested);
                adsManager.addEventListener(
                    google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,
                    onResumeRequested);
    
                // Set a visual element on which clicks should be tracked for video ads
                adsManager.setClickTrackingElement(clickTrackingOverlay);
                try {
                  // Call play to start showing the ad.
                  adsManager.play(videoElement);
                } catch (adError) {
                  // An error may be thrown if there was a problem with the VAST response.
                }
              }
    
              function onAdError(adErrorEvent) {
                // Handle the error logging.
                console.log(adErrorEvent.getError());
              }
    
              function onPauseRequested() {
                videoElement.pause();
                // Setup UI for showing ads (e.g. display ad timer countdown,
                // disable seeking, etc.)
                // setupUIForAd();
              }
    
              function onResumeRequested() {
                // Setup UI back for showing content.
                // setupUIForContent();
                videoElement.play();
              }
    
    
              });
            });
    
    
    
            </script>
            <video id="videohtml5" width="720" height="405" controls="controls" onclick="">
            <source src="#" type="video/mp4">
                  Your browser does not support the video tag.
            </video>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay, this should be really simple, but I have searched all over for the
I have searched everywhere and have yet to get a solution. Okay heres the
Okay, I have literally searched all over the web, but I didn't find what
Okay I have updated my code quite a bit. I am getting a new
Okay I have updated my code a little, but I am still not exactly
Okay so i have this code: if (isset($_GET['book'])) { $query= SELECT book_id, title, authors.`author`
Okay I have searched and can't seem to come up with where to find
Okay, so I have searched this site and found many tutorials on how to
Okay, I have searched online and even looked in a couple of books for
Okay, so I have searched a while for a solution to this problem, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.