File tree Expand file tree Collapse file tree
Cloudinary/Classes/ios/Video Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -128,13 +128,22 @@ import AVKit
128128 }
129129 }
130130
131+ public func flushEvents( ) {
132+ guard analytics else { return }
133+ eventsManager. sendEvents ( )
134+ }
135+
136+ public func flushEventsAndCloseSession( ) {
137+ guard analytics else { return }
138+ eventsManager. sendViewEndEvent ( providedData: providedData)
139+ flushEvents ( )
140+ }
141+
131142 deinit {
132- if analytics {
133- removeObserver ( self , forKeyPath: PlayerKeyPath . status. rawValue)
134- removeObserver ( self , forKeyPath: PlayerKeyPath . timeControlStatus. rawValue)
135- eventsManager. sendViewEndEvent ( providedData: providedData)
136- eventsManager. sendEvents ( )
137- }
143+ guard analytics else { return }
144+ removeObserver ( self , forKeyPath: PlayerKeyPath . status. rawValue)
145+ removeObserver ( self , forKeyPath: PlayerKeyPath . timeControlStatus. rawValue)
146+ flushEventsAndCloseSession ( )
138147 }
139148
140149 func setAnalyticsObservers( ) {
You can’t perform that action at this time.
0 commit comments