onDrawAd method

void onDrawAd(
  1. IosZjEvent event
)

视频流事件回调

Implementation

void onDrawAd(IosZjEvent event) {
  int id = event.viewId;
  if (_drawAdListenerMap.containsKey(id)) {
    Function(IosZjEvent)? listener = _drawAdListenerMap[id];
    if (event.action != IosZjEventAction.onAdClose) {
      // 视频流没有主动关闭事件,View回收时被动调用关闭,移除回调
      listener?.call(event);
    }
    if (event.action == IosZjEventAction.onAdError ||
        event.action == IosZjEventAction.onAdClose) {
      _drawAdListenerMap.remove(id);
    }
  }
}