npaw_forge_interactive_media_ads 10.2.0 copy "npaw_forge_interactive_media_ads: ^10.2.0" to clipboard
npaw_forge_interactive_media_ads: ^10.2.0 copied to clipboard

NPAW Forge ad adapter for Google's interactive_media_ads Flutter plugin: reports typed IMA ad break, quartile and error facts to the Forge core.

npaw_forge_interactive_media_ads #

NPAW Forge ad adapter for Google's official interactive_media_ads Flutter plugin (client-side IMA). Reports typed ad break, lifecycle, quartile and error facts to the Forge core, with event mapping mirroring the Android Forge IMA adapter.

Usage #

The plugin accepts exactly one AdsManagerDelegate per AdsManager, so the adapter builds the delegate itself and chains your own callbacks after the Forge mapping:

import 'package:interactive_media_ads/interactive_media_ads.dart';
import 'package:npaw_forge/npaw_forge.dart';
import 'package:npaw_forge_interactive_media_ads/npaw_forge_interactive_media_ads.dart';

// Content side (any Forge player adapter works, e.g. npaw_forge_video_player):
final contentAttachment = await attachVideoPlayer(forge, controller);

// Inside AdsLoader.onAdsLoaded:
final AdsManager manager = data.manager;
final adsAttachment = await attachImaAds(
  contentAttachment.video,
  manager,
  contentAdapter: contentAttachment.adapter, // couples content pause/resume
  onAdEvent: (AdEvent event) {
    if (event.type == AdEventType.loaded) {
      manager.start();
    }
  },
  onAdErrorEvent: (AdErrorEvent event) => resumeContent(),
);
await manager.init();
// when the view is torn down:
await adsAttachment.dispose();

attachImaAds creates the ad reporter on the Forge video view, attaches the adapter and calls manager.setAdsManagerDelegate(adapter.delegate) for you. When wiring manually, install adapter.delegate yourself; do not set another delegate on the same manager or Forge stops seeing events.

Event mapping #

IMA AdEventType Forge ad fact
loaded ad break start (collapsed) + ad init, caches ad facts
adBreakStarted, contentPauseRequested ad break start (collapsed) + content pause coupling
started ad start + ad join
adProgress promotes a missing join after start
firstQuartile, midpoint, thirdQuartile quartile 1/2/3, strictly in order (out-of-order/duplicates dropped)
paused / resumed ad pause / ad resume
clicked, tapped ad click
skipped ad skip
complete ad stop (creative duration stamped as final ad playhead)
adBreakEnded, contentResumeRequested, allAdsCompleted ad break stop (closes a dangling ad first) + content resume coupling
log non-fatal ad error from adData errorCode/errorMessage (no code or code 1009: skipped)
AdErrorEvent fatal ad error (AdErrorCode enum name + message)

Ad metadata scope #

Populated from the cached AdEvent.ad and the manager:

Forge field Source
creativeId, adTitle, adDurationMs, skippable Ad
adBitrate Ad.vastMediaBitrate (plugin reports Kbps; converted to bps)
position (pre/mid/post) pod timeOffset/podIndex (0 = pre, negative = post, else mid)
givenAds, expectedAds pod totalAds
breakNumber, adNumberInBreak pod podIndex/adPosition (when > 0)
givenBreaks, breaksTime AdsManager.adCuePoints
insertionType always csai (the plugin only exposes client-side insertion)
adProvider always DFP (Android adapter parity)

Not available from the Flutter plugin (reported as absent): ad media URL (adResource), click-through URL (adUrl), live ad playhead (adPlayheadMs outside of complete), and numeric IMA error codes on AdErrorEvent (the plugin only exposes the AdErrorCode enum, so its name is reported). adBuffering has no paired buffer-end event and is not mapped.

0
likes
0
points
636
downloads

Publisher

unverified uploader

Weekly Downloads

NPAW Forge ad adapter for Google's interactive_media_ads Flutter plugin: reports typed IMA ad break, quartile and error facts to the Forge core.

Homepage
Repository

License

unknown (license)

Dependencies

flutter, interactive_media_ads, npaw_forge

More

Packages that depend on npaw_forge_interactive_media_ads