Package com.castlabs.android.player
Class PlayerConfig.Builder
java.lang.Object
com.castlabs.android.player.PlayerConfig.Builder
- Enclosing class:
PlayerConfig
A Builder for
PlayerConfig
.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabrConfiguration
(AbrConfiguration abrConfiguration) Sets theAbrConfiguration
Sets theAdRequest
adSchedule
(AdSchedule adSchedule) Set the AdScheduleallowHlsChunklessPreparation
(boolean value) If set to true, chunk-less preparation of hls tracks are allowedanalyticsMetaData
(AnalyticsMetaData analyticsMetaData) Set the analytics meta-dataanalyticsSessionType
(int analyticsSessionType) Sets the type of analytics sessionaudioAttributes
(AudioAttributes audioAttributes) Set the AudioAttributesaudioCodec
(String codecName) Sets the preferred audio codec for all audio types.audioDecoderFallback
(boolean value) If true (default), allows the player to fallback to other decoders if it failed to initialize the primary decoder.audioTrackGroupIndex
(int audioTrackGroupIndex) Sets the audio track group indexaudioTrackIndex
(int audioTrackIndex) Sets the audio track indexautoPlay
(boolean autoPlay) Sets whether to start playing once enough buffer is availablebufferConfiguration
(BufferConfiguration bufferConfiguration) Sets theBufferConfiguration
casConfiguration
(CasConfiguration casConfiguration) Sets theCasConfiguration
clipPeriods
(boolean clipPeriods) Sets whether to clip periods to their durations (DASH-only) May be necessary when the segments durations are longer than the periods or the segments durations are not-aligned, so the periods should be clipped to periods durations and don't render the segments leftovers.clippingEndUs
(long clippingEndUs) Sets the clipping start position in microsecondsclippingStartUs
(long clippingStartUs) Sets the clipping start position in microsecondsconfigurationUrl
(String configurationUrl) Sets the configuration urlcontentParameters
(Bundle contentParameters) Sets the manifest header parameterscontentQueryParameters
(Bundle contentQueryParameters) Sets the segment query parameterscontentType
(int contentType) Sets the content typecontentUrl
(String contentUrl) Sets the content url.downloadFolder
(String downloadFolder) Sets the download folderdrmConfiguration
(DrmConfiguration drmConfiguration) Sets theDrmConfiguration
enableAdSpeedUp
(boolean enableAdSpeedUp) Sets the flag to enable or disable automatic setting of a speed to 1x when playing ads.enableDashEventCallback
(boolean enableDashEventCallback) Whether to enable internal handling of DASH event callbacksenableLooping
(boolean enableLooping) If set to true then the playback looping will be enabled and the player will automatically restart the playback after reaching end of contentenableTrickplayMode
(boolean enableTrickplayMode) Whether to enable Trickplay playback on start or notenableTunneling
(boolean enableTunneling) Sets whether to enable tunnelingenableTunnelingWithoutAudio
(boolean enableTunnelingWithoutAudio) Sets whether to force tunneling with only video track present.enableWorkaroundEveryVideoFrameIsSyncFrame
(boolean enableWorkaroundEveryVideoFrameIsSyncFrame) Sets whether to enable or disable the workaround whether all video frames are marked as sync frames but should not be treated as sync frames except the very first in a segment (DASH-only).forceInStreamDrmInitData
(boolean forceInStreamDrmInitData) Sets whether to use DRM init data coming from segments or from the manifest (DASH-only).fromBundle
(Bundle bundle) Sets theBuilder
fields according to the stored keys in the givenBundle
.fromConfig
(PlayerConfig config) Sets theBuilder
fields according to the values from the givenPlayerConfig
get()
Builds the PlayerConfig objectSets the configuration idlive
(boolean live) Sets whether this is live contentliveConfiguration
(LiveConfiguration liveConfiguration) Sets theLiveConfiguration
mediaCodecInfos
(ArrayList<MediaCodecInfo> mediaCodecInfos) Sets the preferred codecs for specified mimetypes.mergeVideoTracks
(boolean mergeVideoTracks) Sets whether to merge video tracksSets the Bundle metadatanetworkConfiguration
(NetworkConfiguration networkConfiguration) Sets theNetworkConfiguration
pauseOnHdmiDisconnected
(boolean pauseOnHdmiDisconnected) Enable or disable automatic playback pause on HDMI disconnect Only for API higher or equal to 21positionUs
(long positionUs) Sets the position in microsecondspreferredAudioLanguage
(String preferredAudioLanguage) Sets the preferred audio languagepreferredTextLanguage
(String preferredTextLanguage) Sets the preferred text languagepreservePlayerViewSurface
(boolean preservePlayerViewSurface) If set to true and thePlayerView
is used, the playback surface be kept on screen and preserved when the player player is released.pushBlackScreenOnDispose
(boolean pushBlackScreenOnDispose) If set to true andpreservePlayerViewSurface
is enabled, indicates that the decoder should push a black screen to the surface when disposed.restoreSpeed
(boolean restoreSpeed) Sets the flag to enable or disable automatic restoring of a speed after playing ads.segmentParameters
(Bundle segmentParameters) Sets the segment header parameterssegmentQueryParameters
(Bundle segmentQueryParameters) Sets the segment query parameterssideloadedTracks
(ArrayList<SideloadedTrack> sideloadedTracks) Sets the sideloaded trackssubtitlesTrackGroupIndex
(int subtitlesTrackGroupIndex) Sets the subtitles track group indexsubtitlesTrackIndex
(int subtitlesTrackIndex) Sets the subtitles track indexsubtitleSubSampleType
(int value) Defines whether the subtitle times are absolute or relative.threesixty
(boolean threesixty) Sets whether this is 360 contenttrickplayConfiguration
(TrickplayConfiguration trickplayConfiguration) Sets theTrickplayConfiguration
static Object
Helper function that we use to type check the value extracted from a bundleunsecureDecoderFallback
(boolean value) If true (default), allows the player to fallback to unsecure decoders if it failed to initialize the primary decoder.useEth0
(boolean useEth0) If set to true then the SDK if IPTV is used, eth0 will be used for multicast for multicast receptionSets the user IDuseStandaloneMediaClock
(boolean useStandaloneMediaClock) If set to true, will use Exoplayer'sStandaloneMediaClock
instead of the Renderer Clock.videoCodec
(String codecName) Sets the preferred video codec for all video types.videoCodecFilter
(int videoCodecFilter) Sets the type of video codec filtervideoDecoderFallback
(boolean value) If true (default), allows the player to fallback to other decoders if it failed to initialize the primary decoder.videoFilterConfiguration
(VideoFilterConfiguration videoFilterConfiguration) Set the VideoFilterConfigurationvideoSizeFilter
(Point videoSizeFilter) Deprecated.videoTrackGroupIndex
(int videoTrackGroupIndex) Sets the video track group indexvolume
(float volume) Sets the volume.
-
Constructor Details
-
Builder
- Parameters:
url
- content url
-
Builder
- Parameters:
bundle
- a Bundle where to copy values from.
-
Builder
- Parameters:
config
- an existing PlayerConfig where to copy values from.
-
-
Method Details
-
typeCheck
public static Object typeCheck(@Nullable Object value, @NonNull Class<?> type, @Nullable Object defaultValue, @NonNull String errorMessage) throws IllegalArgumentException Helper function that we use to type check the value extracted from a bundle- Parameters:
value
- the valuetype
- the expected typedefaultValue
- the default valueerrorMessage
- the error message- Returns:
- the value in case the type check passed
- Throws:
IllegalArgumentException
- in case the type check fails
-
fromBundle
Sets theBuilder
fields according to the stored keys in the givenBundle
.- Parameters:
bundle
- the Bundle where to get the values from- Returns:
- the Builder
-
fromConfig
Sets theBuilder
fields according to the values from the givenPlayerConfig
- Parameters:
config
- the PlayerConfig from which to read the values.- Returns:
- the Builder
-
positionUs
Sets the position in microseconds- Parameters:
positionUs
- the value- Returns:
- the Builder
-
clippingStartUs
Sets the clipping start position in microseconds- Parameters:
clippingStartUs
- the value- Returns:
- the Builder
-
clippingEndUs
Sets the clipping start position in microseconds- Parameters:
clippingEndUs
- the value- Returns:
- the Builder
-
subtitlesTrackGroupIndex
Sets the subtitles track group index- Parameters:
subtitlesTrackGroupIndex
- the value- Returns:
- the Builder
-
subtitlesTrackIndex
Sets the subtitles track index- Parameters:
subtitlesTrackIndex
- the value- Returns:
- the Builder
-
audioTrackGroupIndex
Sets the audio track group index- Parameters:
audioTrackGroupIndex
- the value- Returns:
- the Builder
-
audioTrackIndex
Sets the audio track index- Parameters:
audioTrackIndex
- the value- Returns:
- the Builder
-
volume
Sets the volume. 1 is the maximum, and 0 the minimum.- Parameters:
volume
- the value- Returns:
- the Builder
-
pauseOnHdmiDisconnected
Enable or disable automatic playback pause on HDMI disconnect Only for API higher or equal to 21- Parameters:
pauseOnHdmiDisconnected
- the value- Returns:
- the Builder
-
videoTrackGroupIndex
Sets the video track group index- Parameters:
videoTrackGroupIndex
- the value- Returns:
- the Builder
-
abrConfiguration
Sets theAbrConfiguration
- Parameters:
abrConfiguration
- the value- Returns:
- the Builder
-
bufferConfiguration
Sets theBufferConfiguration
- Parameters:
bufferConfiguration
- the value- Returns:
- the Builder
-
mergeVideoTracks
Sets whether to merge video tracks- Parameters:
mergeVideoTracks
- the value- Returns:
- the Builder
-
clipPeriods
Sets whether to clip periods to their durations (DASH-only) May be necessary when the segments durations are longer than the periods or the segments durations are not-aligned, so the periods should be clipped to periods durations and don't render the segments leftovers. Default isPlayerSDK.CLIP_PERIODS
- Parameters:
clipPeriods
- the value- Returns:
- the Builder
-
forceInStreamDrmInitData
Sets whether to use DRM init data coming from segments or from the manifest (DASH-only). The flag does not affect key pre-fetch and initialization data. Set it to true when a key is changed in a segment and not in the manifest Default isPlayerSDK.FORCE_IN_STREAM_DRM_INIT_DATA
- Parameters:
forceInStreamDrmInitData
- the value- Returns:
- the Builder
-
enableWorkaroundEveryVideoFrameIsSyncFrame
public PlayerConfig.Builder enableWorkaroundEveryVideoFrameIsSyncFrame(boolean enableWorkaroundEveryVideoFrameIsSyncFrame) Sets whether to enable or disable the workaround whether all video frames are marked as sync frames but should not be treated as sync frames except the very first in a segment (DASH-only). Default isPlayerSDK.ENABLE_WORKAROUND_EVERY_VIDEO_FRAME_IS_SYNC_FRAME
- Parameters:
enableWorkaroundEveryVideoFrameIsSyncFrame
- the value- Returns:
- the Builder
-
videoCodecFilter
Sets the type of video codec filter- Parameters:
videoCodecFilter
- the value- Returns:
- the Builder
-
mediaCodecInfos
Sets the preferred codecs for specified mimetypes. In case the specified codec does not present on the system then the setting is ignored- Parameters:
mediaCodecInfos
- the value- Returns:
- the Builder
-
videoCodec
Sets the preferred video codec for all video types. To set preferred video codec for specific mimetype, usemediaCodecInfos(ArrayList)
. In case the specified codec does not present on the system then the setting is ignored- Parameters:
codecName
- the codec name as registered in the system e.g. "OMX.google.h264.decoder"- Returns:
- the Builder
-
audioCodec
Sets the preferred audio codec for all audio types. To set preferred audio codec for specific mimetype, usemediaCodecInfos(ArrayList)
. In case the specified codec does not present on the system then the setting is ignored- Parameters:
codecName
- the codec name as registred in the system e.g. "OMX.google.h264.decoder"- Returns:
- the Builder
-
videoSizeFilter
Deprecated.Sets the video size filter- Parameters:
videoSizeFilter
- the value- Returns:
- the Builder
-
downloadFolder
Sets the download folder- Parameters:
downloadFolder
- the value- Returns:
- the Builder
-
enableTunneling
Sets whether to enable tunneling- Parameters:
enableTunneling
- the value- Returns:
- the Builder
-
enableTunnelingWithoutAudio
Sets whether to force tunneling with only video track present. To take effect theenableTunneling(boolean)
should also be on.- Parameters:
enableTunnelingWithoutAudio
- the value- Returns:
- the Builder
-
analyticsSessionType
Sets the type of analytics session- Parameters:
analyticsSessionType
- the value- Returns:
- the Builder
-
userID
Sets the user ID- Parameters:
userID
- the value- Returns:
- the Builder
-
liveConfiguration
Sets theLiveConfiguration
- Parameters:
liveConfiguration
- the value- Returns:
- the Builder
-
networkConfiguration
Sets theNetworkConfiguration
- Parameters:
networkConfiguration
- the value- Returns:
- the Builder
-
trickplayConfiguration
Sets theTrickplayConfiguration
- Parameters:
trickplayConfiguration
- the value- Returns:
- the Builder
-
enableTrickplayMode
Whether to enable Trickplay playback on start or not- Parameters:
enableTrickplayMode
- whether to enable Trickplay playback on start or not- Returns:
- the Builder
-
enableDashEventCallback
Whether to enable internal handling of DASH event callbacks- Parameters:
enableDashEventCallback
- whether to enable internal handling of DASH event callback- Returns:
- the Builder
-
adRequest
Sets theAdRequest
- Parameters:
adRequest
- the value- Returns:
- the Builder
-
enableAdSpeedUp
Sets the flag to enable or disable automatic setting of a speed to 1x when playing ads.- Parameters:
enableAdSpeedUp
- The flag- Returns:
- the Builder
-
restoreSpeed
Sets the flag to enable or disable automatic restoring of a speed after playing ads.- Parameters:
restoreSpeed
- The flag- Returns:
- the Builder
-
configurationUrl
Sets the configuration url- Parameters:
configurationUrl
- the value- Returns:
- the Builder
-
id
Sets the configuration id- Parameters:
id
- the value- Returns:
- the Builder
-
contentUrl
Sets the content url. This is the only mandatory param- Parameters:
contentUrl
- the value. Cannot be null or empty.- Returns:
- the Builder
-
contentType
Sets the content type- Parameters:
contentType
- the value- Returns:
- the Builder
-
autoPlay
Sets whether to start playing once enough buffer is available- Parameters:
autoPlay
- the value- Returns:
- the Builder
-
live
Sets whether this is live content- Parameters:
live
- the value- Returns:
- the Builder
-
threesixty
Sets whether this is 360 content- Parameters:
threesixty
- the value- Returns:
- the Builder
-
preferredTextLanguage
Sets the preferred text language- Parameters:
preferredTextLanguage
- the value- Returns:
- the Builder
-
preferredAudioLanguage
Sets the preferred audio language- Parameters:
preferredAudioLanguage
- the value- Returns:
- the Builder
-
sideloadedTracks
Sets the sideloaded tracks- Parameters:
sideloadedTracks
- the value- Returns:
- the Builder
-
metaData
Sets the Bundle metadata- Parameters:
metaData
- the value- Returns:
- the Builder
-
contentParameters
Sets the manifest header parameters- Parameters:
contentParameters
- the value- Returns:
- the Builder
-
segmentParameters
Sets the segment header parameters- Parameters:
segmentParameters
- the value- Returns:
- the Builder
-
segmentQueryParameters
Sets the segment query parameters- Parameters:
segmentQueryParameters
- the value- Returns:
- the Builder
-
contentQueryParameters
Sets the segment query parameters- Parameters:
contentQueryParameters
- the value- Returns:
- the Builder
-
drmConfiguration
Sets theDrmConfiguration
- Parameters:
drmConfiguration
- the value- Returns:
- the Builder
-
casConfiguration
Sets theCasConfiguration
- Parameters:
casConfiguration
- the value- Returns:
- the Builder
-
preservePlayerViewSurface
If set to true and thePlayerView
is used, the playback surface be kept on screen and preserved when the player player is released. This allows to reuse (instead of re-create) the playback surface and can also be used to keep the last frame on screen even if the underlying player was already released.- Parameters:
preservePlayerViewSurface
- The value- Returns:
- The Builder
-
pushBlackScreenOnDispose
If set to true andpreservePlayerViewSurface
is enabled, indicates that the decoder should push a black screen to the surface when disposed.- Parameters:
pushBlackScreenOnDispose
- The value- Returns:
- The Builder
-
useStandaloneMediaClock
If set to true, will use Exoplayer'sStandaloneMediaClock
instead of the Renderer Clock.There's a known issue when using
SingleControllerPlaylist
in conjunction with Audio Tracks which don't span the entire media duration. With the default Renderer Clock this provokes a freeze when the Audio Track ends.- Parameters:
useStandaloneMediaClock
- The value- Returns:
- The Builder
-
enableLooping
If set to true then the playback looping will be enabled and the player will automatically restart the playback after reaching end of content- Parameters:
enableLooping
- The value- Returns:
- The Builder
-
analyticsMetaData
Set the analytics meta-data- Parameters:
analyticsMetaData
- The analytics meta-data- Returns:
- The builder
-
audioAttributes
Set the AudioAttributes- Parameters:
audioAttributes
- The audio attributes- Returns:
- The builder
-
adSchedule
Set the AdSchedule- Parameters:
adSchedule
- The ad schedule- Returns:
- The builder
-
videoFilterConfiguration
public PlayerConfig.Builder videoFilterConfiguration(VideoFilterConfiguration videoFilterConfiguration) Set the VideoFilterConfiguration- Parameters:
videoFilterConfiguration
- The VideoFilterConfiguration- Returns:
- The builder
-
useEth0
If set to true then the SDK if IPTV is used, eth0 will be used for multicast for multicast reception- Parameters:
useEth0
- The value- Returns:
- The Builder
-
videoDecoderFallback
If true (default), allows the player to fallback to other decoders if it failed to initialize the primary decoder. This can for instance happen if the primary decoder is a hardware implementation and is already blocked by another playback session. In that case, secondary decoders, i.e. software implementations, will be used if possible.- Parameters:
value
- The value- Returns:
- The builder
-
audioDecoderFallback
If true (default), allows the player to fallback to other decoders if it failed to initialize the primary decoder. This can for instance happen if the primary decoder is a hardware implementation and is already blocked by another playback session. In that case, secondary decoders, i.e. software implementations, will be used if possible.- Parameters:
value
- The value- Returns:
- The builder
-
unsecureDecoderFallback
If true (default), allows the player to fallback to unsecure decoders if it failed to initialize the primary decoder. This requiresvideoDecoderFallback(boolean)
)} to be enabled.- Parameters:
value
- The value- Returns:
- The builder
-
allowHlsChunklessPreparation
If set to true, chunk-less preparation of hls tracks are allowed- Parameters:
value
- The value- Returns:
- The builder
-
subtitleSubSampleType
Defines whether the subtitle times are absolute or relative. Could be one ofSdkConsts.SUBTITLE_SUB_SAMPLE_TYPE_ABSOLUTE
orSdkConsts.SUBTITLE_SUB_SAMPLE_TYPE_RELATIVE
.- Parameters:
value
- The value- Returns:
- The builder
-
get
Builds the PlayerConfig object- Returns:
- the PlayerConfig object
-
videoFilterConfiguration(VideoFilterConfiguration)