Class VastTrackersExtKt
-
- All Implemented Interfaces:
public final class VastTrackersExtKt
-
-
Method Summary
Modifier and Type Method Description final static IntegergetOffsetInMillis(EVCTracker $self, Integer totalDurationInMillis)Calculates the offset time in milliseconds for an EVCTracker based on total video duration. final static IntegerconvertDurationToMillis(String $self)Converts a duration string in HH:MM:SS.mmm format to milliseconds. final static List<String>getTrackers(List<NativeTracker> $self, String trackerType)Filters and extracts tracking URLs for a specific tracker event type. -
-
Method Detail
-
getOffsetInMillis
final static Integer getOffsetInMillis(EVCTracker $self, Integer totalDurationInMillis)
Calculates the offset time in milliseconds for an EVCTracker based on total video duration.
This extension function converts the tracker's offset (which can be either a percentage or time-based offset) into an absolute millisecond value based on the total video duration. For percentage offsets, it calculates the proportional time, and for time-based offsets, it converts the time format to milliseconds.
- Parameters:
totalDurationInMillis- The total duration of the video in milliseconds- Returns:
The calculated offset time in milliseconds when this tracker should fire
-
convertDurationToMillis
final static Integer convertDurationToMillis(String $self)
Converts a duration string in HH:MM:SS.mmm format to milliseconds.
This extension function parses a time duration string and converts it to milliseconds. It supports the standard time format used in VAST specifications with optional milliseconds component. The function handles various time formats gracefully.
- Returns:
The duration in milliseconds, or -1 if the format is invalid
-
getTrackers
final static List<String> getTrackers(List<NativeTracker> $self, String trackerType)
Filters and extracts tracking URLs for a specific tracker event type.
This extension function processes a list of NativeTracker instances and returns only the URLs for trackers matching the specified event type. It provides a convenient way to get all tracking URLs that should be fired for a particular video ad event.
- Parameters:
trackerType- The VastTrackerType to filter for- Returns:
List of tracking URLs matching the specified event type, or empty list if none found
-
-
-
-