Simplified integration
-
Integrate the Video Ads SDK using the
script
element in the HTML document header.<html xmlns="http://www.w3.org/1999/xhtml"> <head> <script type="text/javascript" charset="utf-8" src="https://yandex.ru/ads/system/adsdk.js" ></script> </head> </html>
-
Call the
play
method using thescript
element in the HTML document header.<html xmlns="http://www.w3.org/1999/xhtml"> <head> <script type="text/javascript" charset="utf-8" src="https://yandex.ru/ads/system/adsdk.js" ></script> <script> // The method should be available directly from the loader. ya.videoAd.play({ // Video element videoSlot: HTMLVideoElement, // An element for displaying controls. The element's position shouldn't be static. // You can use the video's parent element. slot: HTMLElement, // Loading config and ad playback config. config: AdConfig & PlaybackParams, }):Promise < reject: (error loading ad) resolve: (end of ad) >; </script> </head> </html>
Was the article helpful?
Previous