Video commerce in your Android app.
Use the LiveMarketSDK library for a reviewed video placement. The SDK owns the player surface. Your app owns credentials, cart, consent, and screen lifecycle.
Quick start
Pin an approved package. Create one player for one screen.
- Add the package. Get the private Maven address and credentials from Live Market. Keep them in the host's approved secret store. Pin the exact approved version.
- Configure one environment. Supply a client ID and content token. Add a separate collector token only when the host enables analytics.
- Connect the cart. Set
cartHandlerbeforeload. For a placement without products, setvideoOnly = true. - Bind the view. Use
LiveMarketPlayerViewin Views orLiveMarketPlayerHostin Compose. - Own the lifecycle. Use the main thread for player and view calls. Pause when the screen stops. Call
destroy()when the screen ends.
dependencies {
implementation("market.live:live-market-sdk:<approved-version>")
}val configuration = LiveMarketSDKConfiguration(
environment = LiveMarketEnvironment.STAGING,
business = LiveMarketBusiness(clientId, contentToken, collectorToken),
cartMode = LiveMarketCartMode.MESSAGE,
analytics = LiveMarketAnalyticsConfiguration.DISABLED
)
val player = LiveMarketPlayer(context, configuration)
player.cartHandler = hostCartHandler
player.load(LiveMarketSelection(placementTag), LiveMarketPresentation.GRID)The host supplies context, credentials, placementTag, and hostCartHandler. Set analytics to ENABLED only after you connect the host consent flow. The full guide shows the private Maven repository setup and lifecycle examples.
How it works
Native SDK code reviews service data before it shows a video. The bundled renderer has fixed WebView settings.
The SDK fixes the content route, renderer, and resource policy for each environment. It rejects unapproved URLs and invalid content. It checks the renderer baseline and asset digests before it creates a WebView. The SDK sends analytics in native code. The embedded page does not send duplicate analytics.
A new load cancels the old generation. A new item cancels old media and cart work. A late callback cannot change the active item. The host keeps credentials, cart destinations, and checkout outside the SDK.
Configuration
Use one immutable configuration for one client and environment.
| Input | Use |
|---|---|
LiveMarketBusiness | Supply clientId, contentToken, and an optional distinct collectorToken. |
environment | Choose STAGING for test content or PRODUCTION for production content. |
cartMode | Choose MESSAGE, GET, or POST. The host applies each request. |
analytics | Use DISABLED by default. ENABLED still needs host consent. |
videoOnly | Set true for a video placement without products or cart actions. |
productImageOrigins | Add up to eight reviewed exact HTTPS origins for product images. |
Keep tokens out of source, logs, diagnostics, and WebView data. A mobile app user can inspect an app-owned token. Use limited mobile authority and a service process for rotation and revocation.
Presentations and paging
One video
Show one active video and its reviewed products.
Horizontal cards
Browse portrait preview cards. Open one card for fullscreen playback.
Two columns
Browse portrait preview cards. Open one card for fullscreen playback. Load another page near the end.
FEED shows one active video with next and previous controls. It needs a carousel or grid component with at least two videos. Call load(selection) to use the validated server component. Call load(selection, presentation) to require one surface. Use startingAt to open a feed at a loaded index.
Carousel and grid lists do not play before a video opens. A selected video starts muted playback when it opens in the foreground. Call selectItem(index) for a loaded video. Call closeActiveItem() to close an open carousel or grid video and pause it.
Fullscreen playback
Tap a carousel or grid card to open fullscreen playback. Swipe left for the next video. Swipe right for the previous video. The list does not wrap at either end. Fullscreen stays open when the video changes.
At the end of the loaded grid videos, a forward swipe requests the next page. The current video stays open while the SDK reviews that page. The SDK opens the next video only after review succeeds. Swipe again after a failed page request to retry.
Swipe up or down to close playback and return to the same list position. The inward corner icon and Android Back also close the video. Closing a carousel or grid video pauses playback. Swipes that start on playback or product controls keep their control behavior.
Single video uses a manual fullscreen toggle. Exit returns it to inline playback. Feed uses its own video navigation. The unused inline space is transparent. The bridge stays mounted without an HTML video poster. The fullscreen background is black.
Grid pages. The grid reviews 50 videos first. It requests the next 50 when the shopper scrolls near the end of the loaded cards. It loads covers near visible cards and releases distant grid covers. A failed page shows a retry button. Give a grid view enough height to show two rows on a phone.
itemCount gives the reviewed videos now loaded. totalItemCount gives the reported total. Both counts are at most 500. Select an index from 0 through itemCount - 1.
Set Sort type to Date for more than 50 videos. Manual is available with Filter type: Select shorts. An unset sort works only when all videos fit on one page. An explicit Random sort can repeat or omit videos across pages. The service does not provide a paging snapshot. The panel limits an entered Maximum quantity to 100. An empty value can return more than 100. The SDK accepts at most 500.
Cart handoff
The SDK validates the selected product and variant. The host app changes the cart.
Set cartHandler before load. The handler gets a typed LiveMarketCartRequest. It includes the request ID, selected product and variant, quantity, mode, and an opaque cart parameter. Treat requestId as an idempotency key. Apply each cart change at most once.
| Mode | Host action |
|---|---|
MESSAGE | Apply the typed request in app code or a host service. |
GET | Map reviewed data to an approved host query. |
POST | Map reviewed data to an approved host body. |
The SDK waits up to 15 seconds for a result. It cancels old work when a load or item changes. Return Accepted only after the cart accepts the item. Use Rejected when it does not. Cart acceptance does not mean checkout or payment succeeded.
Analytics and consent
The host owns the consent decision. Analytics stays off by default.
- Configure. Set
analytics = LiveMarketAnalyticsConfiguration.ENABLED. Supply a collector token that differs from the content token. - Grant. Call
grantAnalyticsConsent(userId)after the shopper agrees. - Update. Call
denyAnalyticsConsent()when consent ends. Use identity and session methods when the host identity changes. - Reload. Load the placement again after a consent or identity change to start new attribution.
Native events use the pinned shared contract's schema_version=1.8.0, sdk_name=android, and channel=mobile_app. The host must arrange service deletion for events that the collector already accepted.
Public API
Call player methods and manage the view on the main thread.
Player and views
| API | Use |
|---|---|
LiveMarketPlayer(context, configuration) | Create one player for a screen. |
LiveMarketPlayerView.bind(player) | Bind a player to an Android View. Unbind when the View ends. |
LiveMarketPlayerHost(player) | Show a player in Compose. |
load(...), retry() | Start or retry a placement. A new load replaces the old generation. |
selectItem(index), closeActiveItem() | Open a loaded item or close its video. Carousel and grid open fullscreen. Close returns to the list and pauses playback. |
setForeground(active) | Pause when the screen stops. Foregrounding does not resume paused media. |
play(), pause(), resume(), replay() | Control the active video while the screen is in the foreground. |
seekTo(seconds), setMuted(muted) | Seek when duration is valid or change the mute state. |
destroy() | Cancel work and release the player. Destroy is terminal. |
Values and diagnostics
| Value | Use |
|---|---|
state, progress, isMuted | Read lifecycle, media progress, and mute state in a player listener. |
presentation, itemCount, totalItemCount | Read the surface, loaded count, and reported total. |
activeItemIndex, isPlayerOpen | Read the selected index and whether its video is open. |
commerce, unapprovedProductImageOrigins | Check cart eligibility and exact image origins that need host review. |
report.contentReviewFailure | Read a fixed page review code. page1.item23.products names item 23 and its failed check. |
report.covers | Read up to 100 bounded cover results. Each gives a one-based video position, state, attempts, fixed failure reason, and optional HTTP status. It gives no URL or response body. |
Use LiveMarketPlayerListener.onPlayerChanged(player) for updates. A LiveMarketPlaybackState.Failed value has a bounded error message. Show Retry when the operation can retry.
Integration skill
The repository includes a client integration skill for agent work in a host app. Copy its folder and references/ directory to the client's agent workspace. Check the approved SDK version and its public guide before each use. The skill covers all four presentations, all three cart modes, consent, lifecycle, and staging checks.
Validation and limits
Package pin
Match the Maven version, checksum, signing identity, and release record.
Android host
Exercise each used presentation, cart mode, consent path, and lifecycle on the target devices.
Current SDK
Prerecorded clear video only. No live video, DRM, checkout, or payment.
Keep Android System WebView current. Set android:usesCleartextTraffic="false" or use an equally strict network security configuration. Check the merged app manifest for unexpected dangerous permissions and com.google.android.gms.permission.AD_ID.
Test fullscreen entry, next and previous videos, grid page loading, and each close action in the host app. Check that closing playback keeps the list position. Check playback and product gestures. Check that leaving the screen pauses playback.
Run the SDK and host unit tests and the host Debug build from the sibling android-poc repository. API 31 and API 36 emulator checks do not prove physical-device, performance, or TalkBack behavior. See the full guide and README for setup details.
Android SDK documentation · View source