Class PlaylistItem.Builder
java.lang.Object
com.jwplayer.pub.api.media.playlists.PlaylistItem.Builder
- Enclosing class:
- PlaylistItem
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadSchedule(String vmapUrlOrXML) adSchedule(List<AdBreak> adSchedule) build()description(String description) duration(int durationInSeconds) externalMetadata(List<ExternalMetadata> externalMetadata) httpHeaders(Map<String, String> httpHeaders) imaDaiSettings(ImaDaiSettings imaDaiSettings) liveSyncDuration(double liveSyncDuration) Sets the target live sync duration for live stream playback.mediaDrmCallback(MediaDrmCallback callback) recommendations(String recommendations) sources(List<MediaSource> sources) startTime(double startTime) userInfo(JSONObject userInfo)
-
Constructor Details
-
Builder
public Builder() -
Builder
-
-
Method Details
-
title
- Parameters:
title- Title of the item. This is displayed inside of the player prior to playback, as well as in the visual playlist. This can be hidden with the PlayerConfig.setDisplayTitle() option.
-
description
- Parameters:
description- Short description of the item. It is displayed below the title. This can be hidden with the PlayerConfig.setDisplayDescription() option.
-
file
- Parameters:
file- The media file for this playlist item.
-
image
- Parameters:
image- Poster image URL. Displayed before and after playback.
-
mediaId
- Parameters:
mediaId- Unique identifier of this item. Used by advertising, analytics and discovery services.
-
feedId
- Parameters:
feedId- Unique identifier of this item. Used by Related/Recommendation services.
-
recommendations
- Parameters:
recommendations- URL to a feed that contains related items for a particular playlist item.
-
sources
- Parameters:
sources- Used for quality toggling and alternate sources.
-
tracks
- Parameters:
tracks- Include captions, chapters, and thumbnails for media.
-
adSchedule
- Parameters:
adSchedule- Schedule advertising for a specific media file.
-
adSchedule
- Parameters:
vmapUrlOrXML- Either a local, remote URL of the vmap file, or a VMAP (XML) string.
-
mediaDrmCallback
- Parameters:
callback- DRM callback instance -- used for Widevine DRM.
-
drmConfig
-
userInfo
- Parameters:
userInfo-JSONObjectcontaining information to be passed to Chromecast receivers.
Avoid keyword `sources` if using Studio DRM
-
imaDaiSettings
-
externalMetadata
-
httpHeaders
- Parameters:
httpHeaders- HTTP Headers to include with requests for this media file.
-
startTime
- Parameters:
startTime- value that defines the start time for playlist items
-
duration
- Parameters:
durationInSeconds- value used to display the duration of the video
-
liveSyncDuration
Sets the target live sync duration for live stream playback.This controls how far behind the live edge (in seconds) the player targets during live stream playback (it sets the live target offset; the player still applies its normal correction band around it). A larger offset means the player sits further behind live, which can give downstream processing (e.g. caption handling) more lead time — it does not by itself alter how or when captions are decoded.
Example:
PlaylistItem item = new PlaylistItem.Builder() .file("https://example.com/live/stream.m3u8") .liveSyncDuration(15.0) // Target 15 seconds behind live edge .build();Behavior:
- Values are clamped to the range 5-45 seconds. Values below 5 are set to 5; values above 45 are set to 45.
- A value of 0 (or negative) means unset — the player uses its default behavior.
- This setting only affects live streams; it is ignored for VOD content.
- This overrides any target offset hints from the stream manifest
(e.g., HLS
EXT-X-SERVER-CONTROL).
Risks: Higher values increase the delay between the live broadcast and the viewer. For latency-sensitive content, use the lowest value that meets your needs. Very low values (near 5s) may cause buffering on poor networks.
- Parameters:
liveSyncDuration- The target offset in seconds behind the live edge. Use 0 to leave unset (default behavior). Clamped to 5-45s.- Returns:
- This builder for chaining.
- See Also:
-
build
-