AdRetriever.java


Overview

The `AdRetriever` class serves as a simple data model that encapsulates the key attributes required to request video advertisements from an ad server. It holds identifying information about the media content and context—specifically, the video ID, publisher ID, and the cue point timestamp (referred to as `cubPoint`) indicating when the ad should be played during video playback.

This class is a fundamental part of the ad fetching mechanism within the larger media playback system. It provides a structured way to package ad request parameters that other components, such as the finite state machine (FSM) controlling ad and content playback, use to communicate with the ad server.


Class Details

AdRetriever

public class AdRetriever {
    private String videoId;
    private String publisherId;
    private long cubPoint;

    public AdRetriever() { }

    public AdRetriever(String videoId, String publisherId, long cubPoint) { ... }

    public String getVideoId() { ... }
    public void setVideoId(String videoId) { ... }

    public String getPublisherId() { ... }
    public void setPublisherId(String publisherId) { ... }

    public long getCubPoint() { ... }
    public void setCubPoint(long cubPoint) { ... }
}

Properties

Property

Type

Description

`videoId`

String

Unique identifier for the video content for which ads are being requested.

`publisherId`

String

Identifier for the publisher or channel associated with the video, used for ad targeting.

`cubPoint`

long

The cue point timestamp in milliseconds, indicating the exact point in the video timeline where the ad should be inserted.


Constructors


Getters and Setters


Usage Example

Below is a typical usage scenario where an `AdRetriever` instance is created and populated for requesting ads aligned with a specific video and cue point:

// Assume these values are dynamically determined during playback
String currentVideoId = "video_abc123";
String currentPublisherId = "publisher_xyz789";
long currentCuePoint = 45000L; // 45 seconds into the video

AdRetriever adRequest = new AdRetriever(currentVideoId, currentPublisherId, currentCuePoint);

// This adRequest object can now be sent to the ad server interface
adInterface.fetchAds(adRequest);

Implementation Details


Interaction with Other System Components


Visual Diagram: Class Structure of AdRetriever

classDiagram
    class AdRetriever {
        -videoId: String
        -publisherId: String
        -cubPoint: long
        +AdRetriever()
        +AdRetriever(videoId: String, publisherId: String, cubPoint: long)
        +getVideoId(): String
        +setVideoId(videoId: String): void
        +getPublisherId(): String
        +setPublisherId(publisherId: String): void
        +getCubPoint(): long
        +setCubPoint(cubPoint: long): void
    }

Summary

The `AdRetriever` class is a lightweight, focused data model integral to the ad fetching process in the media playback system. It encapsulates the minimal but critical information required to request ads targeted to a specific video and cue point, enabling the system to synchronize ad playback with content seamlessly. Its design promotes clean separation of concerns by abstracting ad request data from playback logic and network communication.


Additional Context (From Related Documentation)

This class is therefore a cornerstone of the ad and cue point management ecosystem within the application.


End of Documentation for AdRetriever.java