Player UI Controller

Purpose

The Player UI Controller manages the playback user interface components and the resume state information for both content videos and advertisements. Within the broader topic of media playback and UI controls, this controller specifically addresses the challenge of coordinating multiple playback surfaces—such as separate players for content and ads or a WebView for VPAID ads—and preserving playback positions to enable smooth resumption after interruptions or ad breaks.

By encapsulating these concerns, the Player UI Controller ensures seamless transitions between content and ad playback while maintaining consistent UI state, which enhances the overall user experience and playback reliability.

Functionality

Key Methods and Data Flows

Example snippet showing player retrieval for ads, illustrating device-adaptive behavior:

public SimpleExoPlayer getAdPlayer() {
    // Reuse content player for ad playback on single-player devices
    if (PlayerDeviceUtils.useSinglePlayer()) {
        return contentPlayer;
    }
    return adPlayer;
}

Relationship with Parent Topic and Other Subtopics

The Player UI Controller operates as a bridge between the underlying media playback engines and the user interface layer, complementing other subtopics by:

This subtopic introduces the concept of coordinated multi-player and resume state management, which is not covered in the parent topic's general UI control discussions or in other subtopics focused on playback states or ad retrieval. It addresses the complexity arising from the coexistence of content, standard ads, and VPAID ads requiring distinct playback mechanisms.

Diagram

classDiagram
    class PlayerUIController {
        - SimpleExoPlayer contentPlayer
        - SimpleExoPlayer adPlayer
        - WebView vpaidWebView
        - View exoPlayerView
        - int adResumeWindow
        - long adResumePosition
        - int movieResumeWindow
        - long movieResumePosition
        - boolean hasHistory
        - long historyPosition
        + getContentPlayer()
        + getAdPlayer()
        + getVpaidWebView()
        + setPlayFromHistory(pos)
        + hasHistory()
        + getHistoryPosition()
        + setAdResumeInfo(window, position)
        + getAdResumeWindow()
        + getAdResumePosition()
        + setMovieResumeInfo(window, position)
        + getMovieResumeWindow()
        + getMovieResumePosition()
    }
    
    class PlayerDeviceUtils {
        + useSinglePlayer()
    }
    
    PlayerUIController --> PlayerDeviceUtils : uses
    
    %% Notes
    note for PlayerUIController "Manages player instances and resume states\nfor content, ads, and VPAID playback"

This class diagram highlights the core structure of the Player UI Controller, its key fields, and its reliance on device-specific utility logic to select appropriate playback instances. It visually encapsulates the controller’s role in managing multiple playback components and resume state data.