showVideoAd static method
Show an ad using the provided placement ID.
placementId- the placement ID, as defined in Unity Ads admin tools.serverIdonStart- Called when UnityAds has started to show ad with a specific placement.onSkipped- Called when UnityAds skippes show operation for a placement.onClick- Called when UnityAds has received a click while showing ad with a specific placement.onComplete- Called when UnityAds completes show operation successfully for a placement.onFailed- Called when UnityAds has failed to show a specific placement with an error message and error category.
Implementation
static Future<void> showVideoAd({
required String placementId,
String? serverId,
Function(String placementId)? onStart,
Function(String placementId)? onSkipped,
Function(String placementId)? onClick,
Function(String placementId)? onComplete,
Function(String placementId, UnityAdsShowError error, String errorMessage)?
onFailed,
}) async {
_adChannels
.putIfAbsent(placementId, () => _AdMethodChannel(placementId))
.update(
onAdStart: onStart,
onAdClick: onClick,
onAdSkipped: onSkipped,
onShowFailed: onFailed,
onAdComplete: onComplete,
);
final args = <String, dynamic>{
placementIdParameter: placementId,
serverIdParameter: serverId,
};
await _channel.invokeMethod(showVideoMethod, args);
}