VastAdInteractionSandBoxState.java


Overview

`VastAdInteractionSandBoxState` is a concrete state class within the Finite State Machine (FSM) playback system responsible for handling the sandbox environment for user interactions with VAST (Video Ad Serving Template) ads. This state is part of the ad playback lifecycle and primarily represents a transitional or intermediate state where the player UI allows user interaction with VAST ads, such as clicking or engaging with ad elements, before returning control back to the ad playback state.

The class extends `BaseState` and defines how the FSM transitions out of this state based on specific inputs, and how it performs work related to UI updates during this state.


Class: VastAdInteractionSandBoxState

Declaration

public class VastAdInteractionSandBoxState extends BaseState

Purpose

Methods

1. transformToState(Input input, StateFactory factory)

@Override
public State transformToState(Input input, StateFactory factory)
StateFactory factory = ...; // obtained from context
Input input = Input.BACK_TO_PLAYER_FROM_VAST_AD;

VastAdInteractionSandBoxState sandboxState = new VastAdInteractionSandBoxState();
State nextState = sandboxState.transformToState(input, factory);

if (nextState instanceof AdPlayingState) {
    // Proceed with ad playback state
}

2. performWorkAndUpdatePlayerUI(@NonNull FsmPlayer fsmPlayer)

@Override
public void performWorkAndUpdatePlayerUI(@NonNull FsmPlayer fsmPlayer)
FsmPlayer player = ...; // reference to FSM player
VastAdInteractionSandBoxState sandboxState = new VastAdInteractionSandBoxState();
sandboxState.performWorkAndUpdatePlayerUI(player);
// No additional UI changes beyond base state behavior

Important Implementation Details


Interaction with Other Parts of the System


Usage Context

Within the FSM playback system, when a user interacts with a VAST ad (e.g., clicking on the ad that opens a browser or an interactive ad experience), the player might transition into the `VastAdInteractionSandBoxState` to isolate this interaction phase. Once the interaction ends (e.g., the user closes the ad overlay or returns to the player), the FSM receives the input `BACK_TO_PLAYER_FROM_VAST_AD`, transitions back to the `AdPlayingState`, and resumes playback.


Class Diagram

classDiagram
    class BaseState {
        +transformToState(input: Input, factory: StateFactory): State
        +performWorkAndUpdatePlayerUI(fsmPlayer: FsmPlayer): void
        -isNull(obj: Object): boolean
    }

    class VastAdInteractionSandBoxState {
        +transformToState(input: Input, factory: StateFactory): State
        +performWorkAndUpdatePlayerUI(fsmPlayer: FsmPlayer): void
    }

    class AdPlayingState

    VastAdInteractionSandBoxState --|> BaseState
    VastAdInteractionSandBoxState --> AdPlayingState : transitions to on BACK_TO_PLAYER_FROM_VAST_AD input

Summary


End of Documentation for VastAdInteractionSandBoxState.java