RealActivity.java


Overview

`RealActivity` is a concrete implementation of a dual-player video playback activity within the Tubitv media demo app. It extends `DoubleViewTubiPlayerActivity`, a base class designed to manage two ExoPlayer instances simultaneously—one for content playback and another for advertisement playback. `RealActivity` customizes dependency injection by supplying real implementations of the finite state machine (FSM) playback components and provides a user interaction interface overlay for controlling playback.

Specifically, `RealActivity`:

This class acts as the entry point for a real-world playback scenario using all live components rather than mocks or stubs.


Class Details

Class: RealActivity

**Package:** `com.tubitv.media.demo`

**Superclass:** `DoubleViewTubiPlayerActivity`


Methods

protected void injectDependency()

Overrides the base class method to inject dependencies specific to the "real" FSM playback module.


public View addUserInteractionView()

Overrides the method to provide a custom UI controller view layered on top of the video player.


Important Implementation Details


Interaction with Other System Components


Usage Example

// In manifest or app flow, RealActivity is launched to start a playback session with real FSM components.
Intent intent = new Intent(context, RealActivity.class);
context.startActivity(intent);

Once launched, `RealActivity` sets up the dual player environment with real playback and ad logic, injects dependencies, and adds the user interaction controls on top of the video.


Mermaid Class Diagram

classDiagram
    class RealActivity {
        +void injectDependency()
        +View addUserInteractionView()
    }
    RealActivity --|> DoubleViewTubiPlayerActivity

    class DoubleViewTubiPlayerActivity {
        <<abstract>>
        +void injectDependency()
        +View addUserInteractionView()
        +UserController getPlayerController()
        -- ExoPlayer mMoviePlayer
        -- ExoPlayer adPlayer
        -- WebView vpaidWebView
        -- View mTubiPlayerView
    }

    class PlayerControllerUI {
        +PlayerControllerUI(Context context)
        +PlayerControllerUI setController(UserController controller)
    }

    RealActivity ..> PlayerControllerUI : uses
    RealActivity ..> DaggerFsmComonentReal : uses
    RealActivity ..> FSMModuleReal : uses

Summary

`RealActivity` is a thin but crucial subclass that configures the dual ExoPlayer-based video playback activity to use real FSM playback components with full dependency injection and provides a custom user control interface. It acts as the concrete playback activity in the Tubitv app demo, enabling rich video and ad playback experiences with modular and testable architecture. The actual playback lifecycle, FSM logic, and ad management are delegated to its superclass and injected classes.


References