loadFullscreenVideoAd method

Future<PangleResult> loadFullscreenVideoAd({
  1. IOSFullscreenVideoConfig? iOS,
  2. AndroidFullscreenVideoConfig? android,
  3. PangleEventCallback? callback,
})

Request full screen video ad data.

全屏视频广告,新模板渲染插屏 iOS config for iOS android config for Android callback event callback return code & message.

Implementation

Future<PangleResult> loadFullscreenVideoAd({
  IOSFullscreenVideoConfig? iOS,
  AndroidFullscreenVideoConfig? android,
  PangleEventCallback? callback,
}) async {
  final subscription = _eventChannel
      .receiveBroadcastStream(PangleEventType.fullscreen.index)
      .listen((dynamic event) {
    callback?.call(event);
  });
  Map<String, dynamic>? result;
  try {
    if (Platform.isIOS && iOS != null) {
      result = await _methodChannel.invokeMapMethod<String, dynamic>(
        'loadFullscreenVideoAd',
        iOS.toJSON(),
      );
    } else if (Platform.isAndroid && android != null) {
      result = await _methodChannel.invokeMapMethod<String, dynamic>(
        'loadFullscreenVideoAd',
        android.toJSON(),
      );
    }
  } finally {
    subscription.cancel();
  }
  return PangleResult.fromJson(result);
}