StreamCameraUploadView

Contract of the camera capture view, BunnyStreamCameraUpload. The same view covers two cases:

  • liveStreamId not set (default): the camera records straight to a new video in your library.

  • liveStreamId set: the camera broadcasts to that existing live stream. The SDK starts the stream on the server when the connection is up and ends it when you call stopRecording.

Before use: call BunnyStreamApi.initialize(...) and make sure the CAMERA and RECORD_AUDIO runtime permissions are granted - startPreview does nothing without them. Configure liveStreamId, dualPublish and the listeners before starting, not mid-broadcast.

The view ships its own controls (start/stop, mute, camera switch, close, status). Set hideDefaultControls to true to drive it from your own UI through the methods below.

Inheritors

Properties

Link copied to clipboard
abstract var bunny: StreamApi?

The SDK instance this view records into. Leave it null to use the one BunnyStreamApi.initialize(...) registered.

Link copied to clipboard

Click listener to receive close clicked event so you can handle it, e.g. finish hosting activity or navigate to some other screen

Link copied to clipboard
abstract var dualPublish: Boolean

When true, publishes to BOTH the primary and backup ingest simultaneously (dual-publish), so a failover is instant — the second ingest is already running.

Link copied to clipboard

Hides default controls, if you plan to use your own

Link copied to clipboard
abstract var liveIngestEndpoint: String?

Optional override for the live RTMP ingest endpoint (e.g. a regional host shown in the Bunny dashboard). null uses the SDK default. Only used when liveStreamId is set.

Link copied to clipboard
abstract var liveStreamId: String?

When set, the view broadcasts to this existing Bunny live stream (RTMP publish using the stream's streamKey) instead of recording a new VOD video. Set to null (default) for the classic camera-upload behavior.

Link copied to clipboard

Listener to receive stream duration

Link copied to clipboard

Listener to receive events about stream status

Functions

Link copied to clipboard
abstract fun isRecording(): Boolean

Returns true while a recording or live broadcast is running. Covers both the VOD-record and the live-broadcast case despite the name.

Link copied to clipboard
abstract fun setAudioMuted(muted: Boolean)

Mutes or unmutes the microphone. The video keeps streaming either way.

Link copied to clipboard
abstract fun startPreview()

Starts the camera preview.

Link copied to clipboard
abstract fun stopRecording()

Stops the recording or broadcast. For a live stream (liveStreamId set) this also ends the stream on the server, so viewers see it as ended. Stop through this method rather than just tearing the view down; otherwise the stream stays live for viewers until the server times it out.

Link copied to clipboard
abstract fun switchCamera()

Switches between the front and back camera. Works during preview and mid-broadcast.