CuePointsRetriever.java
Overview
The `CuePointsRetriever` class is a simple data model within the media module of the Tubitv project that encapsulates the essential identifiers required to retrieve cue points for a specific video. Cue points are timestamps within a video indicating where advertisements should be inserted (e.g., preroll, midroll, postroll). This class functions primarily as a carrier of `videoId` and `publisherId` data needed to query cue point information from an external service or ad server.
By abstracting cue point retrieval parameters into this dedicated class, the system cleanly separates concerns, maintaining modularity between cue point data handling and other ad-related functionalities. It plays a foundational role in the broader **Ad and Cue Point Management** system by supporting the initial step of cue point acquisition that triggers subsequent ad retrieval and playback workflows.
Class: CuePointsRetriever
package com.tubitv.media.models;
/**
* Created by allensun on 8/17/17.
* on Tubitv.com, [email protected]
*/
public class CuePointsRetriever {
private String videoId;
private String publisherId;
public CuePointsRetriever() {
}
public CuePointsRetriever(String videoId, String publisherId) {
this.videoId = videoId;
this.publisherId = publisherId;
}
public String getVideoId() {
return videoId;
}
public void setVideoId(String videoId) {
this.videoId = videoId;
}
public String getPublisherId() {
return publisherId;
}
public void setPublisherId(String publisherId) {
this.publisherId = publisherId;
}
}
Description
`CuePointsRetriever` encapsulates the identifiers necessary for requesting cue points from the ad or cue point server.
Properties
Property | Type | Description |
|---|---|---|
`videoId` | String | Unique identifier for the video content. |
`publisherId` | String | Unique identifier for the publisher. |
Constructors
Constructor | Description |
|---|---|
`CuePointsRetriever()` | Default no-argument constructor for flexibility. |
`CuePointsRetriever(String videoId, String publisherId)` | Initializes with the given video and publisher IDs. |
Methods
Method | Return Type | Parameters | Description |
|---|---|---|---|
`getVideoId()` | String | None | Returns the current `videoId`. |
`setVideoId(String videoId)` | void | `videoId`: String | Sets the `videoId` property. |
`getPublisherId()` | String | None | Returns the current `publisherId`. |
`setPublisherId(String publisherId)` | void | `publisherId`: String | Sets the `publisherId` property. |
Usage Example
// Creating an instance with video and publisher identifiers
CuePointsRetriever retriever = new CuePointsRetriever("video123", "publisherXYZ");
// Accessing the videoId
String vid = retriever.getVideoId(); // returns "video123"
// Updating the publisherId
retriever.setPublisherId("newPublisherId");
Implementation Details
This class is a Plain Old Java Object (POJO) with no logic beyond simple data encapsulation.
It provides flexibility with a no-argument constructor and a parameterized constructor for ease of use.
Getters and setters allow for mutable access to the identifiers, supporting scenarios where IDs may be assigned or updated after object creation.
Interaction with Other System Components
Cue Point Retrieval Service:
CuePointsRetrieverinstances are passed to cue point retrieval mechanisms or services that query the ad server or a cue point provider to fetch cue point data.Finite State Machine (FSM) Player: The retrieved cue points, requested via this retriever, inform the FSM player about exact timings for ad insertion transitions.
Ad and Playback Modules: While
CuePointsRetrieveritself does not interact directly with playback or ad modules, it is a critical input object enabling those modules to operate with accurate timing data.AdRetriever Class: Complementary to
CuePointsRetriever, theAdRetrieverclass uses similar IDs but adds the cue point timestamp to fetch specific ads for insertion.
Summary
`CuePointsRetriever` acts as a minimal but essential data carrier that enables the system to request cue points tied to specific videos and publishers. It is part of the broader architecture that manages ad insertion during video playback, ensuring ads are triggered at the correct moments based on the retrieved cue points.
Mermaid Class Diagram
classDiagram
class CuePointsRetriever {
- videoId: String
- publisherId: String
+ CuePointsRetriever()
+ CuePointsRetriever(videoId: String, publisherId: String)
+ getVideoId(): String
+ setVideoId(videoId: String): void
+ getPublisherId(): String
+ setPublisherId(publisherId: String): void
}
Additional Context: Cue Point Retrieval Workflow
The process involving `CuePointsRetriever` typically follows this workflow:
Initialization: An instance is created with the video and publisher IDs.
Request Dispatch: This instance is used to send a request to the cue point service or ad server.
Response Handling: The system receives cue point data, such as timestamps for preroll, midroll, and postroll ads.
Playback Coordination: The FSM player uses this data to schedule ad calls and playback transitions.
flowchart TD
A[Initialize CuePointsRetriever] --> B[Send Cue Point Request]
B --> C[Receive Cue Point Data]
C --> D{Cue Points Present?}
D -->|Yes| E[Notify FSM to Trigger Ad Calls]
D -->|No| F[Continue Content Playback]
E --> F
This flowchart visualizes how `CuePointsRetriever` fits within the cue point retrieval and ad insertion lifecycle.