Class NativeMRC50VideoManager
-
- All Implemented Interfaces:
-
com.inmobi.media.ads.common.viewability.interfaces.IViewabilityManager
public final class NativeMRC50VideoManager implements IViewabilityManager
Manages MRC50 (Media Rating Council) viewability tracking for native video ads.
This manager listens to video playback events (VideoProgress, VideoStart, VideoPause) from the VideoMRC50Model.mediaEventFlow. It aims to emit an event via the registerForTracking flow when the video has been playing continuously for a minimum duration specified by VideoMRC50Model.minDuration, effectively signaling that the MRC50 viewability criteria for video duration has been met.
Tracking resets if the video starts again or is paused.
-
-
Constructor Summary
Constructors Constructor Description NativeMRC50VideoManager(VideoMRC50Model videoMRC50Model)
-
Method Summary
Modifier and Type Method Description Flow<Unit>registerForTracking()Registers for MRC 50% video viewability tracking. Unitdestroy()Destroys the viewability manager and releases all associated resources. -
-
Constructor Detail
-
NativeMRC50VideoManager
NativeMRC50VideoManager(VideoMRC50Model videoMRC50Model)
-
-
Method Detail
-
registerForTracking
Flow<Unit> registerForTracking()
Registers for MRC 50% video viewability tracking.
This function returns a Flow that will emit a single Unit value when the video has met the MRC 50% duration criteria (i.e., played continuously for VideoMRC50Model.minDuration).
The flow collects video events from VideoMRC50Model.mediaEventFlow:
On VideoProgress: Checks if the cumulative playback time has reached the target.
On VideoStart or VideoPause: Resets the tracking state.
Operations within this flow are performed on the Dispatchers.Main thread.
- Returns:
A Flow that emits Unit when MRC 50% video duration criteria are met.
-
destroy
Unit destroy()
Destroys the viewability manager and releases all associated resources.
This method terminates viewability tracking and performs complete cleanup of all resources including observers, timers, background tasks, and any registered listeners. After calling destroy, the manager should not emit further events and cannot be reused without re-instantiation.
-
-
-
-