Focus is not transferrable to iframe game when Video Ad Skip button event occurs

211 views Asked by At

My website has some video ads. After the video ad is shown (ima.adevent.type.complete occurs), the game gets keyboard focus ok with the code below. However, Focus is not properly given to game in case when video Ad was Skipped with a Skip button click, meaning the case google.ima.AdEvent.Type.SKIPPED occurs in code below.

case google.ima.AdEvent.Type.SKIPPED:
  case google.ima.AdEvent.Type.COMPLETE:
  // This event indicates the ad has finished - the video player
  // can perform appropriate UI actions, such as removing the timer for
  // remaining time detection.
  if (ad.isLinear()) {
    clearInterval(intervalTimer);
  }
  focusWhenReady = function () {
    doc = iframe.contentDocument || iframe.contentWindow.document;
    if (doc.readyState == "complete") {
      iframe.contentWindow.focus();
      console.log('code comes here in both cases ...');
    } else {
      setTimeout(focusWhenReady, 200)
    }
  }
  setTimeout(focusWhenReady, 100);
0

There are 0 answers