nl_tokens: In order for the SDK to display ads for our video we need to tell it where to put them so here we define our ad container . This div is set up to render on top of the video player . Using the code below we tell the SDK to render ads within that div . We also provide a handle to the content video player - the SDK will poll the current time of our player to properly place mid - rolls . After we create the ad display container we initialize it . On mobile devices this initialization is done as the result of a user action .
pl_tokens: function setupIMA ( ) { // Create the container for our advertisements this . elements . container = createElement ( 'div' , { class : this . player . config . classNames . ads } ) ; this . player . elements . container . appendChild ( this . elements . <mask> ) ; // So we can run VPAID2 google . ima . settings . setVpaidMode ( google . ima . ImaSdkSettings . VpaidMode . ENABLED ) ; // Set language google . ima . settings . setLocale ( this . player . config . ads . language ) ; // Set playback for iOS10+ google . ima . settings . setDisableCustomPlaybackForIOS10Plus ( this . player . config . playsinline ) ; // We assume the adContainer is the video container of the plyr element that will house the ads this . elements . displayContainer = new google . ima . AdDisplayContainer ( this . elements . container , this . player . media ) ; // Request video ads to be pre-loaded this . requestAds ( ) ; }