ExoPlayer.Builder
class ExoPlayer.Builder
A builder for ExoPlayer
instances.
See Builder
for the list of default values.
Summary
Public constructors |
---|
Creates a builder. |
@UnstableApi Creates a builder with a custom |
@UnstableApi Creates a builder with a custom |
@UnstableApi Creates a builder with a custom |
@UnstableApi Creates a builder with the specified custom components. |
Public functions |
|
---|---|
ExoPlayer! |
build() Builds an |
ExoPlayer.Builder! |
@CanIgnoreReturnValue Sets whether dynamic scheduling is enabled. |
ExoPlayer.Builder! |
Sets a limit on the time a call to |
ExoPlayer.Builder! |
@CanIgnoreReturnValue Sets the |
ExoPlayer.Builder! |
@CanIgnoreReturnValue Sets |
ExoPlayer.Builder! |
@CanIgnoreReturnValue Sets the |
ExoPlayer.Builder! |
Sets the |
ExoPlayer.Builder! |
@CanIgnoreReturnValue Sets a timeout for detaching a surface from the player. |
ExoPlayer.Builder! |
@CanIgnoreReturnValue Sets whether the player is allowed to set, increase, decrease or mute device volume. |
ExoPlayer.Builder! |
@CanIgnoreReturnValue Sets whether the player should pause automatically when audio is rerouted from a headset to device speakers. |
ExoPlayer.Builder! |
@CanIgnoreReturnValue Sets the |
ExoPlayer.Builder! |
@CanIgnoreReturnValue Sets the |
ExoPlayer.Builder! |
@CanIgnoreReturnValue Sets the |
ExoPlayer.Builder! |
@CanIgnoreReturnValue Sets the maximum position for which |
ExoPlayer.Builder! |
@CanIgnoreReturnValue Sets the |
ExoPlayer.Builder! |
@CanIgnoreReturnValue Sets the player name that is included in the |
ExoPlayer.Builder! |
@CanIgnoreReturnValue Sets whether to pause playback at the end of each media item. |
ExoPlayer.Builder! |
@CanIgnoreReturnValue Sets the |
ExoPlayer.Builder! |
@CanIgnoreReturnValue Sets the |
ExoPlayer.Builder! |
@CanIgnoreReturnValue Sets an |
ExoPlayer.Builder! |
@CanIgnoreReturnValue Sets a timeout for calls to |
ExoPlayer.Builder! |
@CanIgnoreReturnValue Sets the |
ExoPlayer.Builder! |
@CanIgnoreReturnValue Sets the |
ExoPlayer.Builder! |
@CanIgnoreReturnValue Sets the |
ExoPlayer.Builder! |
@CanIgnoreReturnValue Sets the parameters that control how seek operations are performed. |
ExoPlayer.Builder! |
@CanIgnoreReturnValue Sets whether silences silences in the audio stream is enabled. |
ExoPlayer.Builder! |
@CanIgnoreReturnValue Sets whether the player should suppress playback that is attempted on an unsuitable output. |
ExoPlayer.Builder! |
@CanIgnoreReturnValue Sets the |
ExoPlayer.Builder! |
@CanIgnoreReturnValue Sets whether media sources should be initialized lazily. |
ExoPlayer.Builder! |
@CanIgnoreReturnValue Sets whether the player reports diagnostics data to the Android platform. |
ExoPlayer.Builder! |
@CanIgnoreReturnValue Sets a |
ExoPlayer.Builder! |
@CanIgnoreReturnValue Sets the |
ExoPlayer.Builder! |
@CanIgnoreReturnValue Sets the |
Public constructors
Builder
Builder(context: Context!)
Creates a builder.
Use Builder
, Builder
or Builder
instead, if you intend to provide a custom RenderersFactory
, or DefaultMediaSourceFactory
. This is to ensure that ProGuard or R8 can remove ExoPlayer's DefaultRenderersFactory
, DefaultExtractorsFactory
and DefaultMediaSourceFactory
from the APK.
The builder uses the following default values:
RenderersFactory
:DefaultRenderersFactory
TrackSelector
:DefaultTrackSelector
MediaSource.Factory
:DefaultMediaSourceFactory
LoadControl
:DefaultLoadControl
BandwidthMeter
:getSingletonInstance
LivePlaybackSpeedControl
:DefaultLivePlaybackSpeedControl
Looper
: TheLooper
associated with the current thread, or the of the application's main thread if the current thread doesn't have aAnalyticsCollector
:AnalyticsCollector
withDEFAULT
C.Priority
:PRIORITY_PLAYBACK
PriorityTaskManager
:null
(not used)AudioAttributes
:DEFAULT
, not handling audio focusC.WakeMode
:WAKE_MODE_NONE
handleAudioBecomingNoisy
:false
suppressPlaybackOnUnsuitableOutput
:false
skipSilenceEnabled
:false
C.VideoScalingMode
:VIDEO_SCALING_MODE_DEFAULT
C.VideoChangeFrameRateStrategy
:VIDEO_CHANGE_FRAME_RATE_STRATEGY_ONLY_IF_SEAMLESS
useLazyPreparation
:true
SeekParameters
:DEFAULT
seekBackIncrementMs
:DEFAULT_SEEK_BACK_INCREMENT_MS
seekForwardIncrementMs
:DEFAULT_SEEK_FORWARD_INCREMENT_MS
maxSeekToPreviousPositionMs
:DEFAULT_MAX_SEEK_TO_PREVIOUS_POSITION_MS
releaseTimeoutMs
:DEFAULT_RELEASE_TIMEOUT_MS
detachSurfaceTimeoutMs
:DEFAULT_DETACH_SURFACE_TIMEOUT_MS
pauseAtEndOfMediaItems
:false
usePlatformDiagnostics
:true
Clock
:DEFAULT
playbackLooper
:null
(create new thread)dynamicSchedulingEnabled
:false
Builder
@UnstableApi
Builder(context: Context!, mediaSourceFactory: MediaSource.Factory!)
Creates a builder with a custom MediaSource.Factory
.
See Builder
for a list of default values.
Note that this constructor is only useful to try and ensure that ExoPlayer's (and therefore DefaultExtractorsFactory
) can be removed by ProGuard or R8.
Parameters | |
---|---|
context: Context! |
A |
mediaSourceFactory: MediaSource.Factory! |
A factory for creating a |
Builder
@UnstableApi
Builder(context: Context!, renderersFactory: RenderersFactory!)
Creates a builder with a custom RenderersFactory
.
See Builder
for a list of default values.
Note that this constructor is only useful to try and ensure that ExoPlayer's can be removed by ProGuard or R8.
Parameters | |
---|---|
context: Context! |
A |
renderersFactory: RenderersFactory! |
A factory for creating |
Builder
@UnstableApi
Builder(
context: Context!,
renderersFactory: RenderersFactory!,
mediaSourceFactory: MediaSource.Factory!
)
Creates a builder with a custom RenderersFactory
and MediaSource.Factory
.
See Builder
for a list of default values.
Note that this constructor is only useful to try and ensure that ExoPlayer's , DefaultMediaSourceFactory
(and therefore ) can be removed by ProGuard or R8.
Parameters | |
---|---|
context: Context! |
A |
renderersFactory: RenderersFactory! |
A factory for creating |
mediaSourceFactory: MediaSource.Factory! |
A factory for creating a |
Builder
@UnstableApi
Builder(
context: Context!,
renderersFactory: RenderersFactory!,
mediaSourceFactory: MediaSource.Factory!,
trackSelector: TrackSelector!,
loadControl: LoadControl!,
bandwidthMeter: BandwidthMeter!,
analyticsCollector: AnalyticsCollector!
)
Creates a builder with the specified custom components.
Note that this constructor is only useful to try and ensure that ExoPlayer's default components can be removed by ProGuard or R8.
Parameters | |
---|---|
context: Context! |
A |
renderersFactory: RenderersFactory! |
A factory for creating |
mediaSourceFactory: MediaSource.Factory! |
|
trackSelector: TrackSelector! |
|
loadControl: LoadControl! |
A |
bandwidthMeter: BandwidthMeter! |
|
analyticsCollector: AnalyticsCollector! |
Public functions
build
fun build(): ExoPlayer!
Builds an ExoPlayer
instance.
Throws | |
---|---|
java.lang.IllegalStateException |
If this method has already been called. |
experimentalSetDynamicSchedulingEnabled
@CanIgnoreReturnValue
@UnstableApi
fun experimentalSetDynamicSchedulingEnabled(
dynamicSchedulingEnabled: Boolean
): ExoPlayer.Builder!
Sets whether dynamic scheduling is enabled.
If enabled, ExoPlayer's playback loop will run as rarely as possible by scheduling work for when Renderer
progress can be made.
This method is experimental, and will be renamed or removed in a future release.
Parameters | |
---|---|
dynamicSchedulingEnabled: Boolean |
Whether to enable dynamic scheduling. |
experimentalSetForegroundModeTimeoutMs
@CanIgnoreReturnValue
@UnstableApi
fun experimentalSetForegroundModeTimeoutMs(timeoutMs: Long): ExoPlayer.Builder!
Sets a limit on the time a call to setForegroundMode
can spend. If a call to setForegroundMode
takes more than timeoutMs
milliseconds to complete, the player will raise an error via onPlayerError
.
This method is experimental, and will be renamed or removed in a future release.
Parameters | |
---|---|
timeoutMs: Long |
The time limit in milliseconds. |
setAnalyticsCollector
@CanIgnoreReturnValue
@UnstableApi
fun setAnalyticsCollector(analyticsCollector: AnalyticsCollector!): ExoPlayer.Builder!
Sets the AnalyticsCollector
that will collect and forward all player events.
Parameters | |
---|---|
analyticsCollector: AnalyticsCollector! |
Returns | |
---|---|
ExoPlayer.Builder! |
This builder. |
Throws | |
---|---|
java.lang.IllegalStateException |
If |
setAudioAttributes
@CanIgnoreReturnValue
fun setAudioAttributes(
audioAttributes: AudioAttributes!,
handleAudioFocus: Boolean
): ExoPlayer.Builder!
Sets AudioAttributes
that will be used by the player and whether to handle audio focus.
If audio focus should be handled, the usage
must be USAGE_MEDIA
or USAGE_GAME
. Other usages will throw an .
Parameters | |
---|---|
audioAttributes: AudioAttributes! |
|
handleAudioFocus: Boolean |
Whether the player should handle audio focus. |
Returns | |
---|---|
ExoPlayer.Builder! |
This builder. |
Throws | |
---|---|
java.lang.IllegalStateException |
If |
setBandwidthMeter
@CanIgnoreReturnValue
@UnstableApi
fun setBandwidthMeter(bandwidthMeter: BandwidthMeter!): ExoPlayer.Builder!
Sets the BandwidthMeter
that will be used by the player.
Parameters | |
---|---|
bandwidthMeter: BandwidthMeter! |
Returns | |
---|---|
ExoPlayer.Builder! |
This builder. |
Throws | |
---|---|
java.lang.IllegalStateException |
If |
setClock
@CanIgnoreReturnValue
@UnstableApi
@VisibleForTesting
fun setClock(clock: Clock!): ExoPlayer.Builder!
Sets the Clock
that will be used by the player. Should only be set for testing purposes.
Returns | |
---|---|
ExoPlayer.Builder! |
This builder. |
Throws | |
---|---|
java.lang.IllegalStateException |
If |
setDetachSurfaceTimeoutMs
@CanIgnoreReturnValue
@UnstableApi
fun setDetachSurfaceTimeoutMs(detachSurfaceTimeoutMs: Long): ExoPlayer.Builder!
Sets a timeout for detaching a surface from the player.
If detaching a surface or replacing a surface takes more than
detachSurfaceTimeoutMs
to complete, the player will report an error via onPlayerError
.
Parameters | |
---|---|
detachSurfaceTimeoutMs: Long |
The timeout for detaching a surface, in milliseconds. |
Returns | |
---|---|
ExoPlayer.Builder! |
This builder. |
Throws | |
---|---|
java.lang.IllegalStateException |
If |
setDeviceVolumeControlEnabled
@CanIgnoreReturnValue
@UnstableApi
fun setDeviceVolumeControlEnabled(deviceVolumeControlEnabled: Boolean): ExoPlayer.Builder!
Sets whether the player is allowed to set, increase, decrease or mute device volume.
Parameters | |
---|---|
deviceVolumeControlEnabled: Boolean |
Whether controlling device volume is enabled. |
Returns | |
---|---|
ExoPlayer.Builder! |
This builder. |
Throws | |
---|---|
java.lang.IllegalStateException |
If |
setHandleAudioBecomingNoisy
@CanIgnoreReturnValue
fun setHandleAudioBecomingNoisy(handleAudioBecomingNoisy: Boolean): ExoPlayer.Builder!
Sets whether the player should pause automatically when audio is rerouted from a headset to device speakers. See the audio becoming noisy documentation for more information.
Parameters | |
---|---|
handleAudioBecomingNoisy: Boolean |
Whether the player should pause automatically when audio is rerouted from a headset to device speakers. |
Returns | |
---|---|
ExoPlayer.Builder! |
This builder. |
Throws | |
---|---|
java.lang.IllegalStateException |
If |
setLivePlaybackSpeedControl
@CanIgnoreReturnValue
@UnstableApi
fun setLivePlaybackSpeedControl(
livePlaybackSpeedControl: LivePlaybackSpeedControl!
): ExoPlayer.Builder!
Sets the LivePlaybackSpeedControl
that will control the playback speed when playing live streams, in order to maintain a steady target offset from the live stream edge.
Parameters | |
---|---|
livePlaybackSpeedControl: LivePlaybackSpeedControl! |
Returns | |
---|---|
ExoPlayer.Builder! |
This builder. |
Throws | |
---|---|
java.lang.IllegalStateException |
If |
setLoadControl
@CanIgnoreReturnValue
@UnstableApi
fun setLoadControl(loadControl: LoadControl!): ExoPlayer.Builder!
Sets the LoadControl
that will be used by the player.
Parameters | |
---|---|
loadControl: LoadControl! |
A |
Returns | |
---|---|
ExoPlayer.Builder! |
This builder. |
Throws | |
---|---|
java.lang.IllegalStateException |
If |
setLooper
@CanIgnoreReturnValue
@UnstableApi
fun setLooper(looper: Looper!): ExoPlayer.Builder!
Sets the Looper
that must be used for all calls to the player and that is used to call listeners on.
Returns | |
---|---|
ExoPlayer.Builder! |
This builder. |
Throws | |
---|---|
java.lang.IllegalStateException |
If |
setMaxSeekToPreviousPositionMs
@CanIgnoreReturnValue
@UnstableApi
fun setMaxSeekToPreviousPositionMs(
maxSeekToPreviousPositionMs: @IntRange(from = 0) Long
): ExoPlayer.Builder!
Sets the maximum position for which seekToPrevious
seeks to the previous .
Parameters | |
---|---|
maxSeekToPreviousPositionMs: @IntRange(from = 0) Long |
The maximum position, in milliseconds. |
Returns | |
---|---|
ExoPlayer.Builder! |
This builder. |
Throws | |
---|---|
java.lang.IllegalArgumentException |
If |
java.lang.IllegalStateException |
If |
setMediaSourceFactory
@CanIgnoreReturnValue
fun setMediaSourceFactory(mediaSourceFactory: MediaSource.Factory!): ExoPlayer.Builder!
Sets the MediaSource.Factory
that will be used by the player.
Parameters | |
---|---|
mediaSourceFactory: MediaSource.Factory! |
Returns | |
---|---|
ExoPlayer.Builder! |
This builder. |
Throws | |
---|---|
java.lang.IllegalStateException |
If |
setName
@CanIgnoreReturnValue
@UnstableApi
fun setName(playerName: String!): ExoPlayer.Builder!
Sets the player name that is included in the PlayerId
for informational purpose to recognize the player by its PlayerId
.
The default is an empty string.
Returns | |
---|---|
ExoPlayer.Builder! |
This builder. |
Throws | |
---|---|
java.lang.IllegalStateException |
If |
setPauseAtEndOfMediaItems
@CanIgnoreReturnValue
@UnstableApi
fun setPauseAtEndOfMediaItems(pauseAtEndOfMediaItems: Boolean): ExoPlayer.Builder!
Sets whether to pause playback at the end of each media item.
This means the player will pause at the end of each window in the current timeline
. Listeners will be informed by a call to onPlayWhenReadyChanged
with the reason PLAY_WHEN_READY_CHANGE_REASON_END_OF_MEDIA_ITEM
when this happens.
Parameters | |
---|---|
pauseAtEndOfMediaItems: Boolean |
Whether to pause playback at the end of each media item. |
Returns | |
---|---|
ExoPlayer.Builder! |
This builder. |
Throws | |
---|---|
java.lang.IllegalStateException |
If |
setPlaybackLooper
@CanIgnoreReturnValue
@UnstableApi
fun setPlaybackLooper(playbackLooper: Looper!): ExoPlayer.Builder!
Sets the Looper
that will be used for playback.
The backing thread should run with priority THREAD_PRIORITY_AUDIO
and should handle messages within 10ms.
Returns | |
---|---|
ExoPlayer.Builder! |
This builder. |
Throws | |
---|---|
java.lang.IllegalStateException |
If |
setPriority
@CanIgnoreReturnValue
@UnstableApi
fun setPriority(@C.Priority priority: Int): ExoPlayer.Builder!
Sets the C.Priority
for this player.
The priority may influence resource allocation between multiple players or other components running in the same app.
This priority is used for the PriorityTaskManager
, if set
.
Parameters | |
---|---|
@C.Priority priority: Int |
The |
setPriorityTaskManager
@CanIgnoreReturnValue
@UnstableApi
fun setPriorityTaskManager(priorityTaskManager: PriorityTaskManager?): ExoPlayer.Builder!
Sets an PriorityTaskManager
that will be used by the player.
The priority set via setPriority
(or by default)
will be set while the player is loading.
Parameters | |
---|---|
priorityTaskManager: PriorityTaskManager? |
A |
Returns | |
---|---|
ExoPlayer.Builder! |
This builder. |
Throws | |
---|---|
java.lang.IllegalStateException |
If |
setReleaseTimeoutMs
@CanIgnoreReturnValue
@UnstableApi
fun setReleaseTimeoutMs(releaseTimeoutMs: Long): ExoPlayer.Builder!
Sets a timeout for calls to release
and setForegroundMode
.
If a call to release
or setForegroundMode
takes more than
timeoutMs
to complete, the player will report an error via onPlayerError
.
Parameters | |
---|---|
releaseTimeoutMs: Long |
The release timeout, in milliseconds. |
Returns | |
---|---|
ExoPlayer.Builder! |
This builder. |
Throws | |
---|---|
java.lang.IllegalStateException |
If |
setRenderersFactory
@CanIgnoreReturnValue
@UnstableApi
fun setRenderersFactory(renderersFactory: RenderersFactory!): ExoPlayer.Builder!
Sets the RenderersFactory
that will be used by the player.
Parameters | |
---|---|
renderersFactory: RenderersFactory! |
Returns | |
---|---|
ExoPlayer.Builder! |
This builder. |
Throws | |
---|---|
java.lang.IllegalStateException |
If |
setSeekBackIncrementMs
@CanIgnoreReturnValue
@UnstableApi
fun setSeekBackIncrementMs(seekBackIncrementMs: @IntRange(from = 1) Long): ExoPlayer.Builder!
Sets the seekBack
increment.
Returns | |
---|---|
ExoPlayer.Builder! |
This builder. |
Throws | |
---|---|
java.lang.IllegalArgumentException |
If |
java.lang.IllegalStateException |
If |
setSeekForwardIncrementMs
@CanIgnoreReturnValue
@UnstableApi
fun setSeekForwardIncrementMs(seekForwardIncrementMs: @IntRange(from = 1) Long): ExoPlayer.Builder!
Sets the seekForward
increment.
Parameters | |
---|---|
seekForwardIncrementMs: @IntRange(from = 1) Long |
The seek forward increment, in milliseconds. |
Returns | |
---|---|
ExoPlayer.Builder! |
This builder. |
Throws | |
---|---|
java.lang.IllegalArgumentException |
If |
java.lang.IllegalStateException |
If |
setSeekParameters
@CanIgnoreReturnValue
@UnstableApi
fun setSeekParameters(seekParameters: SeekParameters!): ExoPlayer.Builder!
Sets the parameters that control how seek operations are performed.
Parameters | |
---|---|
seekParameters: SeekParameters! |
The |
Returns | |
---|---|
ExoPlayer.Builder! |
This builder. |
Throws | |
---|---|
java.lang.IllegalStateException |
If |
setSkipSilenceEnabled
@CanIgnoreReturnValue
@UnstableApi
fun setSkipSilenceEnabled(skipSilenceEnabled: Boolean): ExoPlayer.Builder!
Sets whether silences silences in the audio stream is enabled.
Parameters | |
---|---|
skipSilenceEnabled: Boolean |
Whether skipping silences is enabled. |
Returns | |
---|---|
ExoPlayer.Builder! |
This builder. |
Throws | |
---|---|
java.lang.IllegalStateException |
If |
setSuppressPlaybackOnUnsuitableOutput
@CanIgnoreReturnValue
@UnstableApi
fun setSuppressPlaybackOnUnsuitableOutput(
suppressPlaybackOnUnsuitableOutput: Boolean
): ExoPlayer.Builder!
Sets whether the player should suppress playback that is attempted on an unsuitable output. An example of an unsuitable audio output is the built-in speaker on a Wear OS device (unless it is explicitly selected by the user).
If called with suppressPlaybackOnUnsuitableOutput = true
, then a playback attempt on an unsuitable audio output will result in calls to onPlaybackSuppressionReasonChanged
with the value PLAYBACK_SUPPRESSION_REASON_UNSUITABLE_AUDIO_OUTPUT
.
Callers of this may also want to enable setHandleAudioBecomingNoisy
to prevent playback from continuing on the built-in speaker when a headset is disconnected.
Parameters | |
---|---|
suppressPlaybackOnUnsuitableOutput: Boolean |
Whether the player should suppress the playback when it is attempted on an unsuitable output. |
Returns | |
---|---|
ExoPlayer.Builder! |
This builder. |
Throws | |
---|---|
java.lang.IllegalStateException |
If |
setTrackSelector
@CanIgnoreReturnValue
@UnstableApi
fun setTrackSelector(trackSelector: TrackSelector!): ExoPlayer.Builder!
Sets the TrackSelector
that will be used by the player.
Parameters | |
---|---|
trackSelector: TrackSelector! |
Returns | |
---|---|
ExoPlayer.Builder! |
This builder. |
Throws | |
---|---|
java.lang.IllegalStateException |
If |
setUseLazyPreparation
@CanIgnoreReturnValue
@UnstableApi
fun setUseLazyPreparation(useLazyPreparation: Boolean): ExoPlayer.Builder!
Sets whether media sources should be initialized lazily.
If false, all initial preparation steps (e.g., manifest loads) happen immediately. If true, these initial preparations are triggered only when the player starts buffering the media.
Parameters | |
---|---|
useLazyPreparation: Boolean |
Whether to use lazy preparation. |
Returns | |
---|---|
ExoPlayer.Builder! |
This builder. |
Throws | |
---|---|
java.lang.IllegalStateException |
If |
setUsePlatformDiagnostics
@CanIgnoreReturnValue
@UnstableApi
fun setUsePlatformDiagnostics(usePlatformDiagnostics: Boolean): ExoPlayer.Builder!
Sets whether the player reports diagnostics data to the Android platform.
If enabled, the player will use the android.media.metrics.MediaMetricsManager
to create a android.media.metrics.PlaybackSession
and forward playback events and performance data to this session. This helps to provide system performance and debugging information for media playback on the device. This data may also be collected by Google if sharing usage and diagnostics data is enabled by the user of the device.
Parameters | |
---|---|
usePlatformDiagnostics: Boolean |
Whether the player reports diagnostics data to the Android platform. |
Returns | |
---|---|
ExoPlayer.Builder! |
This builder. |
Throws | |
---|---|
java.lang.IllegalStateException |
If |
setVideoChangeFrameRateStrategy
@CanIgnoreReturnValue
@UnstableApi
fun setVideoChangeFrameRateStrategy(
@C.VideoChangeFrameRateStrategy videoChangeFrameRateStrategy: Int
): ExoPlayer.Builder!
Sets a C.VideoChangeFrameRateStrategy
that will be used by the player when provided with a video output Surface
.
The strategy only applies if a MediaCodec
-based video Renderer
is enabled. Applications wishing to use CHANGE_FRAME_RATE_ALWAYS
should set the mode to VIDEO_CHANGE_FRAME_RATE_STRATEGY_OFF
to disable calls to setFrameRate from ExoPlayer, and should then call setFrameRate directly from application code.
Parameters | |
---|---|
@C.VideoChangeFrameRateStrategy videoChangeFrameRateStrategy: Int |
Returns | |
---|---|
ExoPlayer.Builder! |
This builder. |
Throws | |
---|---|
java.lang.IllegalStateException |
If |
setVideoScalingMode
@CanIgnoreReturnValue
@UnstableApi
fun setVideoScalingMode(@C.VideoScalingMode videoScalingMode: Int): ExoPlayer.Builder!
Sets the C.VideoScalingMode
that will be used by the player.
The scaling mode only applies if a MediaCodec
-based video Renderer
is enabled and if the output surface is owned by a SurfaceView
.
Parameters | |
---|---|
@C.VideoScalingMode videoScalingMode: Int |
Returns | |
---|---|
ExoPlayer.Builder! |
This builder. |
Throws | |
---|---|
java.lang.IllegalStateException |
If |
setWakeMode
@CanIgnoreReturnValue
fun setWakeMode(@C.WakeMode wakeMode: Int): ExoPlayer.Builder!
Sets the C.WakeMode
that will be used by the player.
Enabling this feature requires the WAKE_LOCK
permission. It should be used together with a foreground android.app.Service
for use cases where playback occurs and the screen is off (e.g. background audio playback). It is not useful when the screen will be kept on during playback (e.g. foreground video playback).
When enabled, the locks (android.os.PowerManager.WakeLock
/ ) will be held whenever the player is in the STATE_READY
or STATE_BUFFERING
states with playWhenReady = true
. The locks held depend on the specified C.WakeMode
.
Parameters | |
---|---|
@C.WakeMode wakeMode: Int |
A |
Returns | |
---|---|
ExoPlayer.Builder! |
This builder. |
Throws | |
---|---|
java.lang.IllegalStateException |
If |