feat: add onAdError event listener (#3381)
* feat: add onAdError event listener * feat: remove onAdError event listener and use already existing * feat: add ERROR event to docs
This commit is contained in:
committed by
GitHub
parent
4d9334b477
commit
596c02d2b3
@@ -118,8 +118,22 @@ class RCTIMAAdsManager: NSObject, IMAAdsLoaderDelegate, IMAAdsManagerDelegate, I
|
||||
print("AdsManager error: " + error.message!)
|
||||
}
|
||||
|
||||
guard let _video = _video else {return}
|
||||
|
||||
if _video.onReceiveAdEvent != nil {
|
||||
_video.onReceiveAdEvent?([
|
||||
"event": "ERROR",
|
||||
"data": [
|
||||
"message": error.message ?? "",
|
||||
"code": error.code,
|
||||
"type": error.type,
|
||||
],
|
||||
"target": _video.reactTag!
|
||||
])
|
||||
}
|
||||
|
||||
// Fall back to playing content
|
||||
_video?.setPaused(false)
|
||||
_video.setPaused(false)
|
||||
}
|
||||
|
||||
func adsManagerDidRequestContentPause(_ adsManager: IMAAdsManager) {
|
||||
|
@@ -146,7 +146,7 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH
|
||||
name: UIApplication.willResignActiveNotification,
|
||||
object: nil
|
||||
)
|
||||
|
||||
|
||||
NotificationCenter.default.addObserver(
|
||||
self,
|
||||
selector: #selector(applicationDidBecomeActive(notification:)),
|
||||
@@ -1346,11 +1346,11 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH
|
||||
_playerObserver.removePlayerTimeObserver()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@objc func handleAVPlayerAccess(notification:NSNotification!) {
|
||||
let accessLog:AVPlayerItemAccessLog! = (notification.object as! AVPlayerItem).accessLog()
|
||||
let lastEvent:AVPlayerItemAccessLogEvent! = accessLog.events.last
|
||||
|
||||
|
||||
onVideoBandwidthUpdate?(["bitrate": lastEvent.observedBitrate, "target": reactTag])
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user