BunnyStreamCameraUpload
Camera capture view of the Bunny Stream SDK. Add it to a layout:
<net.bunny.bunnystreamcameraupload.BunnyStreamCameraUpload
android:id="@+id/cameraUpload"
android:layout_width="match_parent"
android:layout_height="match_parent" />then request the CAMERA and RECORD_AUDIO runtime permissions and call startPreview. By default the view records the camera to a new video in your library. Set liveStreamId before starting to broadcast to an existing live stream instead - the SDK resolves the ingest, starts the stream on the server once connected, shows primary/backup badges and reconnects on network drops. See StreamCameraUploadView for the full contract.
The view resolves its SDK instance when a recording starts, not when it is built, so it is safe to inflate it before BunnyStreamApi.initialize(...) has run. There has to be an instance by the time the user starts recording — the default one, or one assigned to bunny.
XML attributes: brvDefaultCamera ("back" or "front") picks the starting camera; brvHideDefaultControls hides the built-in controls, same as hideDefaultControls.
Properties
Click listener to receive close clicked event so you can handle it, e.g. finish hosting activity or navigate to some other screen
When true, publishes to BOTH the primary and backup ingest simultaneously (dual-publish), so a failover is instant — the second ingest is already running.
Hides default controls, if you plan to use your own
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.
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.
Listener to receive stream duration
Listener to receive events about stream status
Functions
Returns true while a recording or live broadcast is running. Covers both the VOD-record and the live-broadcast case despite the name.
Mutes or unmutes the microphone. The video keeps streaming either way.
Starts the camera preview.
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.
Switches between the front and back camera. Works during preview and mid-broadcast.