dailymotion / vast-client-js

VAST (up to 6) parsing library for JavaScript
https://iabtechlab.com/wp-content/uploads/2022/09/VAST_4.3.pdf
MIT License
367 stars 215 forks source link

Using pre-bundled versions on HTML file #423

Closed evrencoskun closed 2 years ago

evrencoskun commented 2 years ago

Hi everyone, First of all, thank you for the Library.

When I use the pre-bundled version in my embedded script, it doesn't work as expected.

What could I be missing?

HTML file;

`

<!DOCTYPE HTML>
<HTML>
<head>
<title>VAST Client JS Test</title>
<script
  type="text/javascript"
  src="src/vast-client-browser.min.js"
 ></script>
 </head>
 <body>
 <div id="app"></div>
 <script type="text/javascript">
  document.getElementById("app").innerHTML = "Hello World";

  var vastClient = new VAST.VASTClient();

  var tagURL =
    "https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/single_ad_samples&ciu_szs=300x250&impl=s&gdfp_req=1&env=vp&output=vast&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ct%3Dlinear&correlator=";

  vastClient
    .get(tagURL)
    .then((res) => {
      document.getElementById("app").innerHTML = res;
    })
    .catch((err) => {
      // Deal with the error
      console.log(err);
      document.getElementById("app").innerHTML = err;
    });
</script>
</body>
</html>

`

I've downloaded the vast-client-browser.min.js file and put it into the src folder.

Please check out my demo

Actually, what I'm working on is to use the pre-bundled version within the Android application, but I'm facing a similar problem there.

ZacharieTFR commented 2 years ago

Hello @evrencoskun, it seems that your import are wrongs, I updated your demo with a hosted version of the build file and it works fine.

image

evrencoskun commented 2 years ago

Yes, it worked for me as well. Thanks for that! @ZacharieTFR