Skip to main content

Initialize

Initialize BambuserSDK in your Application class. Do not use an Activity context to avoid memory leaks.

HostApplication.kt
import com.bambuser.social_commerce_sdk.BambuserSDK
import com.bambuser.social_commerce_sdk.data.OrganizationServer

class HostApplication : Application() {
lateinit var globalBambuserSDK: BambuserSDK

override fun onCreate() {
super.onCreate()
globalBambuserSDK = BambuserSDK(
applicationContext = this,
organizationServer = OrganizationServer.US // or OrganizationServer.EU
)
}
}

Play a Live Show​

Call GetLiveView on your SDK instance inside a Composable. Provide the show ID as BambuserVideoAsset.Live(id):

LiveActivity.kt
@Composable
fun LivePlayerScreen(showId: String) {
application.globalBambuserSDK.GetLiveView(
modifier = Modifier.fillMaxSize(),
videoConfiguration = BambuserVideoConfiguration(
events = listOf("*"),
configuration = mapOf(
"buttons" to mapOf("dismiss" to "none"),
"currency" to "USD",
"locale" to "en-US",
"autoplay" to true,
),
videoType = BambuserVideoAsset.Live(showId)
),
videoPlayerDelegate = videoPlayerDelegate
)
}

Player Controls​

Use PlayerActions — provided in the onVideoStatusChanged callback — to control playback programmatically. This is useful when autoplay is false or when responding to app lifecycle events.

val videoPlayerDelegate = object : BambuserVideoPlayerDelegate {
override fun onVideoStatusChanged(
playerId: String,
state: BambuserVideoState,
playerActions: PlayerActions
) {
when (state) {
BambuserVideoState.READY -> {
// autoplay is false — start manually
playerActions.play()
}
BambuserVideoState.ERROR -> {
// Handle error state
}
else -> Unit
}
}

override fun onNewEventReceived(playerId, event, viewAction) { }
override fun onErrorOccurred(playerId, error) { }
}
MethodDescription
play()Starts or resumes playback
pause()Pauses playback
mute()Mutes audio
unMute()Unmutes audio

Player Properties​

Player ID​

The playerId parameter in all delegate callbacks is the unique identifier for the player instance. It matches the playerId you passed to GetLiveView (auto-generated if omitted).

application.globalBambuserSDK.GetLiveView(
playerId = "my-player", // optional, UUID used if not provided
...
)

Current State​

Read the current state via the state parameter in onVideoStatusChanged, or track it yourself:

var currentState: BambuserVideoState = BambuserVideoState.INITIALIZED

override fun onVideoStatusChanged(playerId: String, state: BambuserVideoState, playerActions: PlayerActions) {
currentState = state
}

Live player state sequence with autoplay: true: LOADING → PLAYING

For state change notifications, implement onVideoStatusChanged in your delegate — see Delegate Protocol.