Class HybridVideoExperienceManager

  • All Implemented Interfaces:

    
    public final class HybridVideoExperienceManager
    
                        

    Manages the lifecycle and experience of a hybrid HTML video ad. This class acts as a bridge between the RenderView (hosting the ad) and the HtmlMediaPlayer (handling video playback), coordinating loading, inflation, playback control, and event handling.

    • Constructor Detail

      • HybridVideoExperienceManager

        HybridVideoExperienceManager(RenderView renderView, AdConfig.HybridNativeConfig hybridNativeConfig, HtmlVideoPlayerRequest videoRequestConfig, HtmlVideoEventsListener videoPlaybackListener, RenderViewTelemetryManager telemetryManager, InMobiLogger logger)
        Parameters:
        renderView - The RenderView hosting the hybrid video ad.
        hybridNativeConfig - Configuration parameters for hybrid native ads.
        videoRequestConfig - Configuration for the HTML video player request.
        videoPlaybackListener - Listener for video playback events.
        telemetryManager - Optional telemetry manager for reporting events.
        logger - Optional logger for debugging and error reporting.
    • Method Detail

      • getHybridPlayerScope

         final <Error class: unknown class> getHybridPlayerScope()

        Dedicated scope separation: IO for background + main for UI

      • load

         final Boolean load(HtmlVideoLoadListener videoLoadListener)

        Loads video assets into the underlying HtmlMediaPlayer. This initiates video pre-caching and preparation for playback.

        Parameters:
        videoLoadListener - A listener to be notified of video load success or failure.
      • inflate

         final Unit inflate(ViewGroup parentView)

        Inflates (attaches) the video container view to the supplied parent view and starts the player, which may begin playback if autoplay is enabled.

        Parameters:
        parentView - The ViewGroup to which the player view will be added.
      • impressionFired

         final Unit impressionFired()

        Notifies the OMID ad session that an impression has occurred.

      • handleVideoPlayerActions

         final Boolean handleVideoPlayerActions(VideoPlayerActions action)

        Handles function calls originating from the JavaScript layer of the ad creative.

        Returns:

        A result value if the function is expected to return one (e.g., getPlaybackState), otherwise null.

      • updateVideoPosition

         final Boolean updateVideoPosition(VideoViewPosition newVideoViewPosition)

        Updates the on-screen position and dimensions of the video player view.

        Parameters:
        newVideoViewPosition - The new position and size to apply.
      • handleMute

         final Boolean handleMute(Boolean mute)

        Mutes or unmutes the player's audio.

        Parameters:
        mute - true to mute, false to unmute.
      • handleShowPlayer

         final Boolean handleShowPlayer(Boolean show)

        Shows or hides the player view.

        Parameters:
        show - true to make the player visible, false to hide it.
      • handleVisibilityChange

         final Unit handleVisibilityChange(Boolean isViewable)

        Propagates viewability changes from the hosting RenderView to the media player, allowing it to automatically pause or resume playback based on visibility.

        Parameters:
        isViewable - true if the ad container is visible, false otherwise.
      • handleOnWindowVisible

         final Unit handleOnWindowVisible()

        Called when the ad container becomes visible on screen. Resumes playback only if the last tracked state was paused.

      • handleOnWindowGone

         final Unit handleOnWindowGone()

        Called when the ad container is no longer visible on screen. Stops playback and all associated tracking.

      • destroy

         final Unit destroy()

        Releases all resources, stops playback, and terminates all coroutine scopes. This must be called to prevent memory leaks when the ad is destroyed.