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