# Autoplay

ByteArk Player SDK for Android supports starting playback automatically once the player is ready, configured through withAutoPlay() on ByteArkPlayerBuilder.

# Usage

val playerBuilder = ByteArkPlayerBuilder.Builder()
  .withContext(this)
  .withAutoPlay()
  .withControl()
  .build()
1
2
3
4
5

Or via the helper ByteArkPlayerFragment.createPlayerBuilderWithConfig:

val playerBuilder = ByteArkPlayerFragment.createPlayerBuilderWithConfig(
  true,  // autoPlay
  // ...
)
1
2
3
4

Note

On Android, autoplay with sound may be restricted by the system in some scenarios (e.g., the user has just installed the app and has not yet played media manually). To ensure playback starts reliably, consider also using withMuted() to start playback muted.