# Options

The player is configured through several helper functions on ByteArkPlayerFragment that return setting objects you pass to createInstance(...).

# ByteArkPlayerBuilder

Built via ByteArkPlayerFragment.createPlayerBuilderWithConfig(...) or ByteArkPlayerBuilder.Builder(). Enables/disables core player capabilities.

Builder method Type Default Description
withAutoPlay() flag false Start playback automatically once ready
withControl() flag false Show the control bar
withMuted() flag false Start muted
withFullScreenButton() flag false Show full-screen button
withPictureInPicture() flag false Enable Picture-in-Picture
withSeekButtons() flag false Show seek-forward/backward buttons
withSeekTime(seekTime: Long) Long 10 Seek step (seconds)
withSettingButton() flag false Show settings button (quality, speed, subtitles, etc.)
withShareOption() flag false Show the share button
withEnableBackButton() flag false Show the back button
withBackButtonAction(action: Runnable) Runnable - Custom action when back is pressed
withBackgroundPlaying() flag false Keep audio playing when the app is backgrounded
withSecureSurface() flag false Enable secure surface for DRM content (prevent screen capture)
withBrandingResourceId(id: Int) Int - Resource ID of the brand logo displayed on the player
withLicenseKey(licenseKey: String) String - ByteArk Player SDK license key
withCastContext(castContext: CastContext) CastContext - Chromecast context (required when using Chromecast)
withPlayerItem(item: ByteArkPlayerItem) object - Initial video
withPlaylist(playlist: ByteArkPlayerPlaylist) object - Initial playlist
withAds() flag false Enable the advertising system (Google IMA)
withAdTagUrl(url: String) String - VAST/VMAP ad tag URL
withDefaultCompanionAdSlot() flag false Enable default Companion Ad slot
withDefaultCompanionAdSize(width: Int, height: Int) Int, Int - Companion Ad dimensions
withAdsInsertionSetting(setting: ByteArkAdsInsertionSetting) object - Configure Ads Insertion
withPlaybackSetting(setting: ByteArkPlaybackSetting) object - Configure playback speed
withNielsenSetting(setting: ByteArkNielsenSetting) object - Configure Nielsen DCR
withLighthouseConfig(config: ByteArkLighthouseSetting) object - Configure ByteArk Lighthouse
withChromecastSetting(config: ByteArkChromeCastSetting) object - Configure Chromecast
withSubtitleSize(size: SubtitleSize) enum - Subtitle font size
withSubtitleBackgroundEnabled(enabled: Boolean) Boolean false Show subtitle background
withSubtitlePaddingBottomPercentage(percentage: Int) Int - Subtitle padding from bottom (%)

# ByteArkPlayerItem

Built via ByteArkPlayerItemBuilder.Builder(). Describes the video to be played.

Builder method Type Required Description
withMediaId(id: String?) String Yes Video ID (required when using Lighthouse)
withTitle(title: String?) String No Video title (required when using Lighthouse)
withSubtitle(subtitle: String?) String No Episode / short description
withUrl(url: String?) String Yes Video URL
withPosterImage(src: String?) String No Poster image URL
withDuration(duration: Long?) Long No Video duration in milliseconds
withShareUrl(url: String?) String No URL used for sharing
withAdTagUrl(url: String?) String No Per-video ad tag URL
withDrmLicenseUrl(url: String?) String No DRM license server URL
withDrmLicenseRequestHeaders(headers: Map<String,String>?) Map No Custom headers for the license request
withByteArkNielsenMetaData(metaData: ByteArkNielsenMetaData) object No Nielsen metadata
withByteArkLighthouseMetaData(metaData: ByteArkLightHouseMetaData) object No Lighthouse metadata

# ByteArkPlaybackSetting

Built via ByteArkPlayerFragment.createPlaybackSetting(speedList, defaultSpeed). Controls playback speed options.

Builder method Type Description
withPlaybackSpeedList(list: List<Float>) List<Float> Available speeds the viewer can pick, e.g., [0.5, 1.0, 1.5, 2.0]
withDefaultSpeed(speed: Float) Float Initial speed (typically 1.0)
withPlaybackSpeed(speed: Float) Float Current speed

# ByteArkChromeCastSetting

Built via ByteArkPlayerFragment.createChromeCastSetting(...) or ByteArkChromecastSettingBuilder.

Builder method Type Description
withAppReceiverId(receiverId: String) String Chromecast Receiver Application ID
withCredential(credential: String) String Credential for the receiver
withOptionalCredential(credential: String) String Optional credential

# ByteArkLighthouseSetting

Built via ByteArkPlayerFragment.createLighthouseSetting(...) or ByteArkLighthouseSettingBuilder.

Builder method Type Description
withProjectId(projectId: String) String Lighthouse Project ID (contact ByteArk to obtain)
withLighthouseUrl(url: String?) String URL of a self-hosted Lighthouse server

# ByteArkNielsenSetting

Built via ByteArkPlayerFragment.createNielsenSetting(...) or ByteArkNielsenSettingBuilder.

Builder method Type Description
withAppId(appId: String) String Nielsen App ID
withAppName(appName: String) String Application name
withSfCode(sfCode: String) String Nielsen country SF Code (e.g., "th")
withNolDevDebug(debug: String) String Debug flag ("DEBUG" or "INFO")

# ByteArkAdsInsertionSetting

Used to insert ads at specific time offsets.

Builder method Type Description
withAdsUrl(adsUrl: String) String Ad tag URL
withDefaultKeyName(key: String) String Key identifying the ad position
withDefaultOffset(offset: Long) Long Default offset in milliseconds

# ByteArkCompanionAdSlot

Built via ByteArkPlayerFragment.createCompanionAdSlot(container, width, height). Defines the container for Companion Ads next to the player.

Builder method Type Description
withContainer(container: ViewGroup) ViewGroup View to host the Companion Ad
withWidth(width: Int) Int Width in pixels
withHeight(height: Int) Int Height in pixels