Skip to main content

Initialization Configuration

During initialization, parameters such as autoplay, muted, volume, and loop attributes can be configured. However, it is also possible to modify the volume and muted attributes at a later time, as per requirements.

Media Initialization Configuration

The initialization configuration can set preferred video, caption, and audio behavior when playback starts. These preferences are applied on supported platforms.

AttributeTypeDescription
videoobjectInitial ABR, bitrate, and latency settings.
captionobjectInitial caption display, language, and source settings.
audioobjectInitial audio language settings.
Media Initialization Example
val luraConfiguration = LuraConfiguration(
initialization = LuraInitializationConfiguration(
video = LuraVideoInitializationConfiguration(
abrEnabled = true,
preferredBitrate = 1000000L,
latencyMode = LatencyModes.DEFAULT
),
caption = LuraCaptionInitializationConfiguration(
enabled = true,
preferredLanguage = "en",
source = listOf("manifest", "embedded")
),
audio = LuraAudioInitializationConfiguration(
preferredLanguage = "en"
)
)
)

playerView = findViewById(R.id.lura_player_view)
player = LuraPlayer(context = this, playerView = playerView)
player.setConfig(luraConfiguration)
AttributeTypeDescription
initialization.video.abrEnabledBooleanEnables or disables ABR on supported platforms.
initialization.video.preferredBitrateLongPreferred starting bitrate on supported platforms.
initialization.video.latencyModeLatencyModePreferred latency mode on initialization.
initialization.caption.enabledBooleanShows or hides captions on initialization.
initialization.caption.preferredLanguageStringPreferred caption language on supported platforms.
initialization.caption.sourceList<String>Caption sources to use. Defaults to ["manifest", "embedded"].
initialization.audio.preferredLanguageStringPreferred audio language on supported platforms.

Autoplay Configuration

The implementation of autoplay attribute can be done in Lura Player using the following configuration.

AttributeTypeDescription
autoplayBooleanAutoplay attribute of the player. Defaults to false
Autoplay Example
val luraConfiguration = LuraConfiguration(
controls = LuraControlsConfiguration(
autoplay = true
)
)

playerView = findViewById(R.id.lura_player_view)
player = LuraPlayer(context = this, playerView = playerView)
player.setConfig(luraConfiguration)

Mute Configuration

The implementation of initially muted attribute can be done in Lura Player using the following configuration.

AttributeTypeDescription
mutedBooleanWhether to start muted when the player autoplays. Defaults to false.
Mute Example
val luraConfiguration = LuraConfiguration(
controls = LuraControlsConfiguration(
muted = true
)
)


playerView = findViewById(R.id.lura_player_view)
player = LuraPlayer(context = this, playerView = playerView)
player.setConfig(luraConfiguration)

Volume Configuration

The implementation of initial volume attribute can be done in Lura Player using the following configuration.

AttributeTypeDescription
volumeDoubleInitial volume of the player between 0.0 and 1.0. Defaults to 1.0
Volume Example
val luraConfiguration = LuraConfiguration(
controls = LuraControlsConfiguration(
volume = 0.9
)
)

playerView = findViewById(R.id.lura_player_view)
player = LuraPlayer(context = this, playerView = playerView)
player.setConfig(luraConfiguration)

Loop Configuration

The implementation of loop attribute can be done in Lura Player using the following configuration.

AttributeTypeDescription
loopBooleanLoop the video when it ends. Defaults to false.
Loop Example
val luraConfiguration = LuraConfiguration(
controls = LuraControlsConfiguration(
loop = true
)
)

playerView = findViewById(R.id.lura_player_view)
player = LuraPlayer(context = this, playerView = playerView)
player.setConfig(luraConfiguration)
Combined Example
val luraConfiguration = LuraConfiguration(
controls = LuraControlsConfiguration(
autoplay = true,
enabled = true,
muted = true,
volume = 0.9,
loop = true
)
)

playerView = findViewById(R.id.lura_player_view)
player = LuraPlayer(context = this, playerView = playerView)
player.setConfig(luraConfiguration)