Class PlayerConfig.Builder
- java.lang.Object
-
- com.jwplayer.pub.api.configuration.PlayerConfig.Builder
-
- Enclosing class:
- PlayerConfig
public static class PlayerConfig.Builder extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description Builder()Default builder constructor.Builder(PlayerConfig src)This constructor will fill the builder with data from an existing PlayerConfig in case you need to duplicate and make a small change
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PlayerConfig.BuilderadvertisingConfig(AdvertisingConfig advertisingConfig)PlayerConfig.BuilderallowCrossProtocolRedirects(java.lang.Boolean allowCrossProtocolRedirects)PlayerConfig.Builderautostart(java.lang.Boolean autostart)PlayerConfigbuild()PlayerConfig.BuilderdisplayDescription(java.lang.Boolean displayDescription)PlayerConfig.BuilderdisplayTitle(java.lang.Boolean displayTitle)PlayerConfig.Builderfile(java.lang.String file)PlayerConfig.Builderimage(java.lang.String image)PlayerConfig.BuilderlogoConfig(LogoConfig logoConfig)Defines a logo which is overlayed on the player.PlayerConfig.Buildermute(java.lang.Boolean mute)PlayerConfig.BuildernextUpOffset(java.lang.Integer nextUpOffset)PlayerConfig.BuildernextUpOffsetPercentage(java.lang.Integer nextUpOffsetPercentage)PlayerConfig.BuilderplaybackRates(double[] playbackRates)PlayerConfig.BuilderplayerId(java.lang.String playerId)Sets the player's "Dashboard Player Configuration Key" (`pid`) used by JWDashboard analytics.PlayerConfig.Builderplaylist(java.util.List<PlaylistItem> playlist)PlayerConfig.BuilderplaylistIndex(java.lang.Integer playlistIndex)PlayerConfig.BuilderplaylistUrl(java.lang.String playlistUrl)PlayerConfig.Builderpreload(java.lang.Boolean preload)PlayerConfig.BuilderrelatedConfig(RelatedConfig relatedConfig)PlayerConfig.Builderrepeat(java.lang.Boolean repeat)PlayerConfig.Builderstretching(java.lang.String stretching)PlayerConfig.BuilderthumbnailPreview(java.lang.Integer thumbnailPreview)PlayerConfig.BuilderuiConfig(UiConfig uiConfig)PlayerConfig.BuilderuseTextureView(boolean useTextureView)SetsTextureViewto be the view where video content will be rendered Notice that by defaultSurfaceViewis using In case of usingTextureViewDRM streams will not be shown TextureView should be used only if SurfaceView does not meet your needs.
-
-
-
Constructor Detail
-
Builder
public Builder()
Default builder constructor.
-
Builder
public Builder(@NonNull PlayerConfig src)This constructor will fill the builder with data from an existing PlayerConfig in case you need to duplicate and make a small change- Parameters:
src-
-
-
Method Detail
-
file
public PlayerConfig.Builder file(java.lang.String file)
- Parameters:
file- URL to a single video file, audio file, or live stream to play.
-
image
public PlayerConfig.Builder image(java.lang.String image)
- Parameters:
image- URL to a poster image to display before playback starts.
-
mute
public PlayerConfig.Builder mute(java.lang.Boolean mute)
- Parameters:
mute- Configures if the player should be muted during playback.
-
autostart
public PlayerConfig.Builder autostart(java.lang.Boolean autostart)
- Parameters:
autostart- Whether the player will attempt to begin playback automatically when a page is loaded.
-
nextUpOffset
public PlayerConfig.Builder nextUpOffset(java.lang.Integer nextUpOffset)
- Parameters:
nextUpOffset- Configures when the Next Up card displays when transitioning between playlist items. A positive value is an offset from the start of the video. A negative number is an offset from the end of the video.
-
playerId
public PlayerConfig.Builder playerId(java.lang.String playerId)
Sets the player's "Dashboard Player Configuration Key" (`pid`) used by JWDashboard analytics. - precondition: The playerID must already exist in the JW Dashboard property associated with the License Key, or else it will be ignored by the analytics platform. - note: Not to be confused with the JS player's `id` property, which is a reference used to tag the actual element/object (such as the `div` in a web browser context).- Parameters:
playerId-
-
nextUpOffsetPercentage
public PlayerConfig.Builder nextUpOffsetPercentage(java.lang.Integer nextUpOffsetPercentage)
- Parameters:
nextUpOffsetPercentage- Configures when the Next Up card displays during playback based on the percentage of the duration. A positive value is a percentage offset from the start of the video. A negative number is a percentage offset from the end of the video i.e. setting the value to 50 will result in the Next Up card showing when half of the video is played. Setting the value to -25 will result in the Next Up card showing when playback reaches 75% of the video duration. Takes precedence over nextupOffset if both properties are set.
-
repeat
public PlayerConfig.Builder repeat(java.lang.Boolean repeat)
- Parameters:
repeat- Configures if the player should loop content after a playlist completes.
-
displayTitle
public PlayerConfig.Builder displayTitle(java.lang.Boolean displayTitle)
- Parameters:
displayTitle- Configures if the title of a media file should be displayed.
-
displayDescription
public PlayerConfig.Builder displayDescription(java.lang.Boolean displayDescription)
- Parameters:
displayDescription- Configures if the description title of a media file should be displayed.
-
thumbnailPreview
public PlayerConfig.Builder thumbnailPreview(java.lang.Integer thumbnailPreview)
- Parameters:
thumbnailPreview- Configures if the thumbnail preview above the seekbar when is seeking through a video should be displayed.
-
stretching
public PlayerConfig.Builder stretching(java.lang.String stretching)
- Parameters:
stretching- Resize images and video to fit player dimensions. Must be one of the STRETCHING_ constants.
-
preload
public PlayerConfig.Builder preload(java.lang.Boolean preload)
- Parameters:
preload- Tells the player if content should be loaded prior to playback. Useful for faster playback speed.
-
playlist
public PlayerConfig.Builder playlist(java.util.List<PlaylistItem> playlist)
- Parameters:
playlist- The playlist of media to play in your player.
-
playlistUrl
public PlayerConfig.Builder playlistUrl(java.lang.String playlistUrl)
- Parameters:
playlistUrl- The playlist URL to play in your player.
-
playlistIndex
public PlayerConfig.Builder playlistIndex(java.lang.Integer playlistIndex)
- Parameters:
playlistIndex- The playlist Index of media to start playing in your player. Its 0 indexed. A positive value is an index from the start of the playlist. A negative number is an index from the end of the playlist. i.e. setting value -1 would end up playing the last video on the playlist.
-
relatedConfig
public PlayerConfig.Builder relatedConfig(RelatedConfig relatedConfig)
- Parameters:
relatedConfig- The related plugin configuration to apply to your player.
-
advertisingConfig
public PlayerConfig.Builder advertisingConfig(AdvertisingConfig advertisingConfig)
- Parameters:
advertisingConfig- The advertising configuration and schedule to apply to your player.
-
uiConfig
public PlayerConfig.Builder uiConfig(UiConfig uiConfig)
- Parameters:
uiConfig- The uiConfig plugin configuration to apply to your player.
-
logoConfig
public PlayerConfig.Builder logoConfig(LogoConfig logoConfig)
Defines a logo which is overlayed on the player.- Parameters:
logoConfig-
-
playbackRates
public PlayerConfig.Builder playbackRates(@NonNull double[] playbackRates)
- Parameters:
playbackRates- The custom playback rate options to display in the settings menu.
-
allowCrossProtocolRedirects
public PlayerConfig.Builder allowCrossProtocolRedirects(java.lang.Boolean allowCrossProtocolRedirects)
-
useTextureView
public PlayerConfig.Builder useTextureView(boolean useTextureView)
SetsTextureViewto be the view where video content will be rendered Notice that by defaultSurfaceViewis using In case of usingTextureViewDRM streams will not be shown TextureView should be used only if SurfaceView does not meet your needs. One example is where smooth animations or scrolling of the video surface is required prior to Android N. For this case, it’s preferable to use TextureView only when SDK_INT is less than 24 (Android N) and SurfaceView otherwise.- Parameters:
useTextureView- whether use TextureView as the View where video content is playing true to useTextureViewfalse to useSurfaceView
-
build
public PlayerConfig build()
-
-