# Advertisement
ByteArk Player SDK for Flutter supports advertisement playback through the Google IMA SDK following the Video Ad Serving Template (VAST) (opens new window) and VMAP standards, configured via adsSettings on ByteArkPlayerConfig.
# Enable
final config = ByteArkPlayerConfig(
licenseKey: licenseKey,
playerItem: playerItem,
adsSettings: ByteArkAdsSettings(
adTagUrl: "<VAST_TAG_URL>",
),
);
1
2
3
4
5
6
7
2
3
4
5
6
7
| Property | Type | Description |
|---|---|---|
adTagUrl | String? | VAST/VMAP ad tag URL |
enableDefaultCompanionSlot | bool? | Enable the default Companion Ad slot |
defaultCompanionSize | Pair<int, int>? | Companion Ad size (width, height) |
# Receive ad events
final listener = ByteArkPlayerListener(
onAdsRequest: () => debugPrint("Ad requested"),
onAdsBreakStart: () => debugPrint("Ad break started"),
onAdsStart: (data) => debugPrint("Ad started: ${data.toMap()}"),
onAdsEnd: () => debugPrint("Ad ended"),
onAdsComplete: () => debugPrint("All ads completed"),
onAdsClicked: () => debugPrint("Ad clicked"),
onAdsSkipped: () => debugPrint("Ad skipped"),
onAdsError: (error) => debugPrint("Ads error: ${error.message}"),
);
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10