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