Class VideoPlayerViewableTracker

  • All Implemented Interfaces:
    com.inmobi.media.ads.common.viewability.ViewabilityManager

    
    public final class VideoPlayerViewableTracker
     implements ViewabilityManager<Boolean>
                        

    Tracks the viewability of a video player view to determine when video should play or pause.

    This class implements ViewabilityManager to provide viewability tracking specifically for video players. It monitors when a video view meets the required visibility criteria (percentage visible, minimum dimensions) and reports viewability status as a boolean flow that can be used to control video playback.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      Flow<Boolean> startTracking() Starts tracking viewability and returns a Flow of boolean values.
      Unit pause() Pauses viewability tracking.
      Unit resume() Resumes viewability tracking.
      Unit stop() Stops viewability tracking and releases resources.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • VideoPlayerViewableTracker

        VideoPlayerViewableTracker(CoroutineScope coroutineScope, View trackingView, ViewableTrackerConfig config)
    • Method Detail

      • startTracking

         Flow<Boolean> startTracking()

        Starts tracking viewability and returns a Flow of boolean values.

        The returned Flow emits true when the video view is viewable (meets the configured visibility criteria) and false when it is not viewable.

        Returns:

        Flow<Boolean> emitting viewability status

      • pause

         Unit pause()

        Pauses viewability tracking.

        This temporarily stops the tracking process without releasing resources, allowing it to be resumed later.

      • resume

         Unit resume()

        Resumes viewability tracking.

        This restarts the tracking process after it has been paused.

      • stop

         Unit stop()

        Stops viewability tracking and releases resources.

        This permanently stops the tracking process and cleans up resources. The tracker cannot be reused after calling this method.