Class VdoInitParams.Builder
-
- All Implemented Interfaces:
public class VdoInitParams.BuilderBuilder class for constructing instances of VdoInitParams.
The
Builderclass allows for a flexible configuration of the playback parameters. It includes methods to set the media's token, OTP, playback information, captions language, and various other options related to the playback experience. Note: For online playback, you should either use the setOtp and setPlaybackInfo methods together or use the setVideoId and setToken methods together.
-
-
Constructor Summary
Constructors Constructor Description VdoInitParams.Builder()
-
Method Summary
Modifier and Type Method Description VdoInitParams.BuildersetVideoId(String videoId)Sets the video ID for online playback. VdoInitParams.BuilderupdateConfig(HashMap<String, Object> configMap)VdoInitParams.BuildersetPlayerConfig(String customPlayerId)VdoInitParams.BuildersetCustomPlayer(String customPlayerId)Sets the custom player ID. VdoInitParams.BuildersetOfflinePlayback(String mediaId)Enables offline playback for a specified media ID. VdoInitParams.BuilderenableOfflinePlayback()Allows the player to use locally saved media files for playback. VdoInitParams.BuildersetClips(int startTimeMs, int endTimeMs)Sets the start and end time for a media clip playback. VdoInitParams.BuildersetClips(int startTimeMs, int endTimeMs, boolean showClipping)Sets the start and end time for a media clip playback. VdoInitParams.BuilderconfigureMediaSource(@NonNull() String mediaUrl)Configures the media source using the specified media URL. VdoInitParams.BuilderconfigureMediaSource(@NonNull() String mediaUrl, @Nullable() String licenseUrl)Configures the media source with a specified media URL and an optional license URL. VdoInitParams.BuildersetResumeTime(int resumeTimeMs)Sets the player resume time in milliseconds. VdoInitParams.BuilderenableAutoResume()Enables automatic resume of playback from the last position. VdoInitParams.BuilderskipMedia3VersionCheck()Skips the Media3 version check. VdoInitParams.BuildersetPlayerLanguage(String languageCode)Sets the language code for the player. VdoInitParamsbuild()VdoInitParams.BuildersetToken(String token)Sets the token for online playback. VdoInitParams.BuildersetOtp(String otp)Sets the OTP for online playback. VdoInitParams.BuildersetPlaybackInfo(String playbackInfo)Sets the playback information for online playback. VdoInitParams.BuildersetAutoplay(boolean autoplay)Sets whether the player should autoplay when the media is ready. VdoInitParams.BuildersetPreferredCaptionsLanguage(String preferredCaptionsLanguage)Sets the preferred captions language for the media. VdoInitParams.BuildersetForceLowestBitrate(boolean forceLowestBitrate)Sets whether to force the use of the lowest bitrate for video playback. VdoInitParams.BuildersetForceHighestSupportedBitrate(boolean forceHighestSupportedBitrate)Sets whether to force the use of the highest supported bitrate for video playback. VdoInitParams.BuildersetMaxVideoBitrateKbps(int maxVideoBitrateKbps)Sets the maximum video bitrate in kilobits per second (kbps). VdoInitParams.BuildersetTechOverride(Array<String> techOverride)Sets the technology override for playback. VdoInitParams.BuildersetDisableAnalytics(boolean disableAnalytics)Sets whether to disable analytics for playback. VdoInitParams.BuildersetAllowAdbDebugging(boolean allowAdbDebugging)Sets whether to allow ADB (Android Debug Bridge) debugging during playback. VdoInitParams.BuildersetVdoMediaMetadata(VdoMediaMetadata vdoMediaMetadata)Sets the media metadata for the Vdo player. -
-
Method Detail
-
setVideoId
VdoInitParams.Builder setVideoId(String videoId)
Sets the video ID for online playback. This method is used to set the video ID necessary for accessing media online.
- Parameters:
videoId- the video ID.- Returns:
the Builder instance for method chaining.
-
updateConfig
VdoInitParams.Builder updateConfig(HashMap<String, Object> configMap)
-
setPlayerConfig
@Deprecated() VdoInitParams.Builder setPlayerConfig(String customPlayerId)
- Parameters:
customPlayerId- the ID of the custom player to be set.- Returns:
the Builder instance for method chaining.
-
setCustomPlayer
VdoInitParams.Builder setCustomPlayer(String customPlayerId)
Sets the custom player ID.
Use this method to specify a custom player ID for the playback. This method replaces the deprecated setPlayerConfig method.
- Parameters:
customPlayerId- the ID of the custom player to be set.- Returns:
the Builder instance for method chaining.
-
setOfflinePlayback
VdoInitParams.Builder setOfflinePlayback(String mediaId)
Enables offline playback for a specified media ID.
This method sets up the player to use locally saved media files for playback.
- Parameters:
mediaId- the ID of the media to be played offline.- Returns:
the Builder instance for method chaining.
-
enableOfflinePlayback
VdoInitParams.Builder enableOfflinePlayback()
Allows the player to use locally saved media files for playback.
This method enables playback of media items that are saved locally without requiring a DRM license. Before using this method, ensure that a valid Token/OTP and Playback Info are provided using setToken and setPlaybackInfo. However, it is generally recommended to use setOfflinePlayback for offline playback, which should be handled with enqueueV2 for downloading media items.
- Returns:
the Builder instance for method chaining.
-
setClips
VdoInitParams.Builder setClips(int startTimeMs, int endTimeMs)
Sets the start and end time for a media clip playback.
This method allows you to specify a portion of the media to be played by defining the start time and the end time in milliseconds. The media will start playing from
startTimeMsand will stop atendTimeMs.If
startTimeMsis set to a value greater than or equal toendTimeMs, the entire media will be played.If not specified, the media will start from the beginning (0 ms) and play until the end.
- Parameters:
startTimeMs- the start time of the media clip in milliseconds.endTimeMs- the end time of the media clip in milliseconds.- Returns:
the Builder instance for method chaining.
-
setClips
VdoInitParams.Builder setClips(int startTimeMs, int endTimeMs, boolean showClipping)
Sets the start and end time for a media clip playback.
This method allows you to specify a portion of the media to be played by defining the start time and the end time in milliseconds. The media will start playing from
startTimeMsand will stop atendTimeMs.If
startTimeMsis set to a value greater than or equal toendTimeMs, the entire media will be played.If not specified, the media will start from the beginning (0 ms) and play until the end.
- Parameters:
startTimeMs- the start time of the media clip in milliseconds.endTimeMs- the end time of the media clip in milliseconds.showClipping- a boolean flag to enable or disable the clipping feature.- Returns:
the Builder instance for method chaining.
-
configureMediaSource
VdoInitParams.Builder configureMediaSource(@NonNull() String mediaUrl)
Configures the media source using the specified media URL.
- Parameters:
mediaUrl- the URL of the media content to be configured- Returns:
the Builder instance with the media source configured
-
configureMediaSource
VdoInitParams.Builder configureMediaSource(@NonNull() String mediaUrl, @Nullable() String licenseUrl)
Configures the media source with a specified media URL and an optional license URL.
- Parameters:
mediaUrl- the URL of the media content to be configuredlicenseUrl- an optional license URL required for restricted media content; may benull- Returns:
the Builder instance with the media and license URLs configured
-
setResumeTime
VdoInitParams.Builder setResumeTime(int resumeTimeMs)
Sets the player resume time in milliseconds.
By specifying a resume time, the player will resume playback from the given timestamp. Setting this will override any global settings related to auto resume.
- Parameters:
resumeTimeMs- the resume time in milliseconds.- Returns:
the Builder instance for method chaining.
-
enableAutoResume
VdoInitParams.Builder enableAutoResume()
Enables automatic resume of playback from the last position.
This method sets the player to automatically resume playback from the last known position when the media is reloaded. This setting overrides any global settings related to auto resume.
- Returns:
the Builder instance for method chaining.
-
skipMedia3VersionCheck
VdoInitParams.Builder skipMedia3VersionCheck()
Skips the Media3 version check.
This method allows the app to bypass the Media3 version check, which is useful if the app is using a different version of Media3 that may have API conflicts. Use this method when you need to ensure compatibility with other versions of Media3, especially if there are known conflicts or issues with the version currently in use.
- Returns:
the Builder instance for method chaining.
-
setPlayerLanguage
VdoInitParams.Builder setPlayerLanguage(String languageCode)
Sets the language code for the player.
This method specifies the language code to be used for the player's interface and any available subtitles or captions. The language code should follow the BCP 47 standard, such as "en" for English or "fr" for French.
- Parameters:
languageCode- the language code to set for the player.- Returns:
the Builder instance for method chaining.
-
build
VdoInitParams build()
-
setToken
VdoInitParams.Builder setToken(String token)
Sets the token for online playback. This method is used to set the token for accessing media online.
- Parameters:
token- the media access token.- Returns:
the Builder instance for method chaining.
-
setOtp
@Deprecated() VdoInitParams.Builder setOtp(String otp)
Sets the OTP for online playback.
- Parameters:
otp- the OTP string.- Returns:
the Builder instance for method chaining.
-
setPlaybackInfo
@Deprecated() VdoInitParams.Builder setPlaybackInfo(String playbackInfo)
Sets the playback information for online playback. This method is used to set the playback information necessary for accessing media online.
- Parameters:
playbackInfo- the playback information string.- Returns:
the Builder instance for method chaining.
-
setAutoplay
VdoInitParams.Builder setAutoplay(boolean autoplay)
Sets whether the player should autoplay when the media is ready.
If
autoplayis set totrue, the media will automatically start playing when it is loaded and ready. If set tofalse, the media will require manual initiation to start playback.- Parameters:
autoplay-trueto enable autoplay,falseto disable it.- Returns:
the Builder instance for method chaining.
-
setPreferredCaptionsLanguage
VdoInitParams.Builder setPreferredCaptionsLanguage(String preferredCaptionsLanguage)
Sets the preferred captions language for the media.
This method specifies the language to be used for captions, if available. The captions will be displayed in the preferred language if it is supported by the media.
- Parameters:
preferredCaptionsLanguage- the preferred captions language as an ISO 639-1 language code (e.g., "en" for English).- Returns:
the Builder instance for method chaining.
-
setForceLowestBitrate
VdoInitParams.Builder setForceLowestBitrate(boolean forceLowestBitrate)
Sets whether to force the use of the lowest bitrate for video playback.
If
forceLowestBitrateis set totrue, the player will prioritize using the lowest available video bitrate, which may help with streaming on slower network connections. If set tofalse, the player will use the default bitrate settings.- Parameters:
forceLowestBitrate-trueto force the lowest bitrate,falseotherwise.- Returns:
the Builder instance for method chaining.
-
setForceHighestSupportedBitrate
VdoInitParams.Builder setForceHighestSupportedBitrate(boolean forceHighestSupportedBitrate)
Sets whether to force the use of the highest supported bitrate for video playback.
If
forceHighestSupportedBitrateis set totrue, the player will use the highest available video bitrate, which may provide better video quality at the cost of increased bandwidth usage. If set tofalse, the player will use the default bitrate settings.- Parameters:
forceHighestSupportedBitrate-trueto force the highest bitrate,falseotherwise.- Returns:
the Builder instance for method chaining.
-
setMaxVideoBitrateKbps
VdoInitParams.Builder setMaxVideoBitrateKbps(int maxVideoBitrateKbps)
Sets the maximum video bitrate in kilobits per second (kbps).
This method limits the video bitrate to the specified value, which can help manage bandwidth usage and control video quality. If the specified value is less than the available bitrates, the player will use the closest lower bitrate.
- Parameters:
maxVideoBitrateKbps- the maximum video bitrate in kilobits per second.- Returns:
the Builder instance for method chaining.
-
setTechOverride
VdoInitParams.Builder setTechOverride(Array<String> techOverride)
Sets the technology override for playback.
This method allows specifying a list of technologies to be used for playback, overriding the default technology settings. If the provided array is
null, an empty array will be used.- Parameters:
techOverride- an array of technology identifiers to override the default playback settings.- Returns:
the Builder instance for method chaining.
-
setDisableAnalytics
VdoInitParams.Builder setDisableAnalytics(boolean disableAnalytics)
Sets whether to disable analytics for playback.
If
disableAnalyticsis set totrue, analytics and tracking features will be disabled. If set tofalse, analytics will be enabled as per the global settings.- Parameters:
disableAnalytics-trueto disable analytics,falseto enable it.- Returns:
the Builder instance for method chaining.
-
setAllowAdbDebugging
VdoInitParams.Builder setAllowAdbDebugging(boolean allowAdbDebugging)
Sets whether to allow ADB (Android Debug Bridge) debugging during playback.
When enabled, this option allows ADB debugging features to be used during playback, which can be useful for debugging and development purposes. By default, ADB debugging is disabled.
- Parameters:
allowAdbDebugging-trueto allow ADB debugging,falseto disallow it.- Returns:
the Builder instance for method chaining.
-
setVdoMediaMetadata
VdoInitParams.Builder setVdoMediaMetadata(VdoMediaMetadata vdoMediaMetadata)
Sets the media metadata for the Vdo player.
This method allows specifying additional metadata for the media being played. The provided VdoMediaMetadata object contains metadata such as title, description, and other relevant information that can be used during playback.
- Parameters:
vdoMediaMetadata- the VdoMediaMetadata object containing media metadata.- Returns:
the Builder instance for method chaining.
-
-
-
-