public final class PlayerConfig
extends java.lang.Object
implements com.longtailvideo.jwplayer.utils.Jsonable
Modifier and Type | Class and Description |
---|---|
static class |
PlayerConfig.Builder |
static interface |
PlayerConfig.Stretching |
Modifier and Type | Field and Description |
---|---|
static boolean |
DEFAULT_ALLOW_CROSS_PROTOCOL_REDIRECTS
Configuration values
|
static java.lang.String |
STRETCHING_EXACT_FIT
Will fit JW Player dimensions without maintaining aspect ratio.
|
static java.lang.String |
STRETCHING_FILL
Will zoom and crop video to fill dimensions, maintaining aspect ratio.
|
static java.lang.String |
STRETCHING_NONE
Displays the actual size of the video file with black borders.
|
static java.lang.String |
STRETCHING_UNIFORM
Will fit JW Player dimensions while maintaining aspect ratio.
|
Constructor and Description |
---|
PlayerConfig(PlayerConfig src)
Copy constructor.
|
Modifier and Type | Method and Description |
---|---|
AdvertisingBase |
getAdvertising() |
boolean |
getAllowCrossProtocolRedirects() |
boolean |
getAutostart() |
CaptionsConfig |
getCaptionsConfig() |
boolean |
getControls() |
boolean |
getDisplayDescription() |
boolean |
getDisplayTitle() |
java.lang.String |
getFile() |
java.lang.String |
getImage() |
LogoConfig |
getLogoConfig() |
boolean |
getMute() |
java.lang.Boolean |
getNextUpDisplay() |
int |
getNextUpOffset() |
int |
getNextUpOffsetPercentage() |
PlaybackRateConfig |
getPlaybackRatesConfig() |
java.util.List<PlaylistItem> |
getPlaylist() |
boolean |
getPreload() |
RelatedConfig |
getRelatedConfig() |
boolean |
getRepeat() |
SharingConfig |
getSharingConfig() |
SkinConfig |
getSkinConfig() |
java.lang.String |
getStretching() |
static PlayerConfig |
parseJson(java.lang.String json)
Parses a PlayerConfig from the given JSON string.
|
void |
setAdvertising(AdvertisingBase advertising) |
void |
setAllowCrossProtocolRedirects(java.lang.Boolean allowCrossProtocolRedirects) |
void |
setAutostart(java.lang.Boolean autoStart) |
void |
setCaptionsConfig(CaptionsConfig captionsConfig) |
void |
setControls(java.lang.Boolean controls) |
void |
setDisplayDescription(java.lang.Boolean displayDescription) |
void |
setDisplayTitle(java.lang.Boolean displayTitle) |
void |
setFile(java.lang.String file) |
void |
setImage(java.lang.String image) |
void |
setLogoConfig(LogoConfig logoConfig) |
void |
setMute(java.lang.Boolean mute) |
void |
setNextUpDisplay(java.lang.Boolean nextUpDisplay) |
void |
setNextUpOffset(java.lang.Integer nextUpOffset) |
void |
setNextUpOffsetPercentage(java.lang.Integer nextUpOffsetPercentage) |
void |
setPlaybackRatesConfig(PlaybackRateConfig playbackRateConfig) |
void |
setPlaylist(java.util.List<PlaylistItem> playlist) |
void |
setPreload(java.lang.Boolean preload) |
void |
setRelatedConfig(RelatedConfig relatedConfig) |
void |
setRepeat(java.lang.Boolean repeat) |
void |
setSharingConfig(SharingConfig sharingConfig) |
void |
setSkinConfig(SkinConfig skinConfig) |
void |
setStretching(java.lang.String stretching) |
void |
setUseTextureView(boolean useTextureView)
Sets
TextureView to be the view where video content will be rendered
Notice that by default SurfaceView is using
In case of using TextureView DRM streams will not be shown
TextureView should be used only if SurfaceView does not meet your needs. |
org.json.JSONObject |
toJson() |
java.lang.String |
toPlayerSetupBlock(com.longtailvideo.jwplayer.analytics.Analytics analytics,
LocalizationConfig config) |
java.lang.String |
toString() |
boolean |
usesAdvertising()
Returns true if this player config uses advertising features.
|
boolean |
usesCaptions()
Returns true if the player config uses any caption features.
|
boolean |
usesDrm() |
boolean |
useTextureView() |
public static final java.lang.String STRETCHING_UNIFORM
public static final java.lang.String STRETCHING_FILL
public static final java.lang.String STRETCHING_EXACT_FIT
public static final java.lang.String STRETCHING_NONE
public static final boolean DEFAULT_ALLOW_CROSS_PROTOCOL_REDIRECTS
public PlayerConfig(PlayerConfig src)
src
- the PlayerConfig to copy.public void setFile(java.lang.String file)
file
- URL to a single video file, audio file, or live stream to play.public void setImage(java.lang.String image)
image
- URL to a poster image to display before playback starts.public void setMute(java.lang.Boolean mute)
mute
- Configures if the player should be muted during playback.public void setAutostart(java.lang.Boolean autoStart)
autoStart
- Whether the player will attempt to begin playback automatically when a page is loaded. Set to 'viewable' to have player autostart if 50% is viewable.public void setNextUpOffset(java.lang.Integer nextUpOffset)
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.public void setNextUpOffsetPercentage(java.lang.Integer nextUpOffsetPercentage)
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.public void setRepeat(java.lang.Boolean repeat)
repeat
- Configures if the player should loop content after a playlist completes.public void setControls(java.lang.Boolean controls)
controls
- Whether to display the video controls (control bar and display icons).public void setDisplayTitle(java.lang.Boolean displayTitle)
displayTitle
- Configures if the title of a media file should be displayed.public void setDisplayDescription(java.lang.Boolean displayDescription)
displayDescription
- Configures if the description title of a media file should be displayed.public void setStretching(java.lang.String stretching)
stretching
- Resize images and video to fit player dimensions. Must be one of the STRETCHING_ constants.public void setNextUpDisplay(java.lang.Boolean nextUpDisplay)
nextUpDisplay
- Configures whether the Next Up modal is displayed.public void setPreload(java.lang.Boolean preload)
preload
- Tells the player if content should be loaded prior to playback. Useful for faster playback speed.public void setPlaylist(java.util.List<PlaylistItem> playlist)
playlist
- The playlist of media to play in your player.public void setCaptionsConfig(CaptionsConfig captionsConfig)
captionsConfig
- The captions configuration to apply to your player.public void setLogoConfig(LogoConfig logoConfig)
logoConfig
- The logo configuration to apply to your player.public void setSkinConfig(SkinConfig skinConfig)
skinConfig
- The skin configuration to apply to your player.public void setRelatedConfig(RelatedConfig relatedConfig)
relatedConfig
- The related plugin configuration to apply to your player.public void setSharingConfig(SharingConfig sharingConfig)
sharingConfig
- The sharing plugin configuration to apply to your player.public void setAdvertising(AdvertisingBase advertising)
advertising
- The advertising configuration and schedule to apply to your player.public void setAllowCrossProtocolRedirects(java.lang.Boolean allowCrossProtocolRedirects)
public void setPlaybackRatesConfig(PlaybackRateConfig playbackRateConfig)
playbackRateConfig
- playback rate config to apply to your player.PlaybackRateConfig
public void setUseTextureView(boolean useTextureView)
TextureView
to be the view where video content will be rendered
Notice that by default SurfaceView
is using
In case of using TextureView
DRM 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.useTextureView
- whether use TextureView as the View where video content is playing
true to use TextureView
false to use SurfaceView
public boolean useTextureView()
TextureView
@Nullable public java.lang.String getFile()
@Nullable public java.lang.String getImage()
public boolean getMute()
public boolean getAutostart()
public int getNextUpOffset()
public int getNextUpOffsetPercentage()
public boolean getRepeat()
public boolean getControls()
public boolean getDisplayTitle()
public boolean getDisplayDescription()
@NonNull public java.lang.String getStretching()
@Nullable public java.lang.Boolean getNextUpDisplay()
public boolean getPreload()
@Nullable public java.util.List<PlaylistItem> getPlaylist()
@Nullable public CaptionsConfig getCaptionsConfig()
@Nullable public LogoConfig getLogoConfig()
@Nullable public SkinConfig getSkinConfig()
public RelatedConfig getRelatedConfig()
public SharingConfig getSharingConfig()
@Nullable public AdvertisingBase getAdvertising()
public PlaybackRateConfig getPlaybackRatesConfig()
public boolean getAllowCrossProtocolRedirects()
public boolean usesAdvertising()
public boolean usesCaptions()
public boolean usesDrm()
public java.lang.String toString()
toString
in class java.lang.Object
public org.json.JSONObject toJson()
toJson
in interface com.longtailvideo.jwplayer.utils.Jsonable
public static PlayerConfig parseJson(java.lang.String json)
json
- the json to parse.public java.lang.String toPlayerSetupBlock(com.longtailvideo.jwplayer.analytics.Analytics analytics, LocalizationConfig config)