mapAds static method

Map<String, dynamic>? mapAds(
  1. ByteArkAdsSettings? ads
)

Builds the JS plugin options block for the SDK's IMA-based ad plugin, or null when no usable adTagUrl is configured. The caller decides whether to attach the result under plugins.bytearkAds (the assumed SDK plugin key; VERIFY) on the player options.

Implementation

static Map<String, dynamic>? mapAds(ByteArkAdsSettings? ads) {
  if (ads == null) return null;
  final adTagUrl = ads.adTagUrl;
  if (adTagUrl == null || adTagUrl.isEmpty) return null;

  final result = <String, dynamic>{
    'adTagUrl': adTagUrl, // VERIFY: SDK may use `tag` / `adsResponse` / etc.
  };

  final enableCompanion = ads.enableDefaultCompanionSlot;
  if (enableCompanion != null) {
    result['enableDefaultCompanionSlot'] = enableCompanion;
  }

  final companionSize = ads.defaultCompanionSize;
  if (companionSize != null) {
    result['defaultCompanionSize'] = <String, dynamic>{
      'width': companionSize.first,
      'height': companionSize.second,
    };
  }

  return result;
}