googleads / videojs-ima

IMA SDK Plugin for Video.js
Apache License 2.0
450 stars 284 forks source link

Trouble Displaying Ads on Android Using videojs-ima - Need Help #1094

Closed EmilianoMorghen closed 1 year ago

EmilianoMorghen commented 1 year ago

Hello,

I hope this project is still active. I am having trouble displaying ads on Android. While reviewing closed issues, I came across this issue, and I tried implementing it using the following Javascript code:

const player = videojs('content_video');

const adsRenderingSettingsObject = {
  mimeTypes: [
    'video/mp4',
    'video/webm',
  ],
};

const options = {
  id: 'content_video',
  adTagUrl: 'http://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/ad_rule_samples&ciu_szs=300x250&ad_rule=1&impl=s&gdfp_req=1&env=vp&output=xml_vmap1&unviewed_position_start=1&cust_params=sample_ar%3Dpremidpostpod%26deployment%3Dgmf-js&cmsid=496&vid=short_onecue&correlator=',
  adsRenderingSettings: adsRenderingSettingsObject,
  contribAdsSettings: {
    debug: true,
  },
  debug: true,
};

I am unsure if my implementation is correct because I am still unable to see the ad on Android. The logs I received are:

VIDEOJS: ADS: Received adsready event (BeforePreroll)
VIDEOJS: ADS: Playback was canceled by cancelContentPlay
VIDEOJS: ADS: Received play event (BeforePreroll)
VIDEOJS: ADS: BeforePreroll -> Preroll
VIDEOJS: ADS: Triggered readyforpreroll event (Preroll)
VIDEOJS: ADS: Starting ad break
VIDEOJS: ADS: Ending ad break
VIDEOJS: ADS: Preroll -> ContentPlayback

Everything works fine on iOS, but in Android after a short amount of time, the ad is skipped and the content video is shown.

Thank you for your help. I look forward to hearing from you soon.

dioramayuanito commented 1 year ago

i think , it should be like this? cmiiw

const options = {
  id: 'content_video',
  adTagUrl: 'http://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/ad_rule_samples&ciu_szs=300x250&ad_rule=1&impl=s&gdfp_req=1&env=vp&output=xml_vmap1&unviewed_position_start=1&cust_params=sample_ar%3Dpremidpostpod%26deployment%3Dgmf-js&cmsid=496&vid=short_onecue&correlator=',
  adsRenderingSettings: adsRenderingSettingsObject,
  contribAdsSettings: {
    debug: true,
  },
  debug: true,
};
EmilianoMorghen commented 1 year ago

@dioramayuanito thank you for your quick reply! You are right, I've updated my source and the issue description too.

Unfortunately, this didn't fix the problem. The ad is still not playing in Android. The logs are the same.

Kiro705 commented 1 year ago

Hello @dioramayuanito ,

Thank you for raising this issue. What would be the best way to reproduce this issue?

I tested using a Pixel 3, with your shared ad tag, on the Advanced Example. Testing here, I saw all ads play as expected.

Thank you, Jackson IMA SDK team

EmilianoMorghen commented 1 year ago

Hello @Kiro705,

I was implementing videojs-ima plugin inside a webview in a React Native project. Today, upon restarting my pc, the ads played correctly.

It was probably a problem related to Metro's cache.

Thank you for your quick reply.