Optional broadcasting features

Switching camera

The Bambuser broadcasting SDKs for Android and iOS let your app use any of the available cameras on a device.

iOS

You can check for a front camera through the BambuserView hasFrontCamera property, optionally expose a Switch camera button in your app UI and then hook it up to the BambuserView swapCamera method.

Android

You can either check for the number of available cameras through the Broadcaster getCameraCount() method, or get more detailed information about the cameras through the getSupportedCameras() method. Based on the available cameras you may show suitable UI components in your app, and can then switch to the next camera using the switchCamera() method, or switch to a specific camera through the setCameraId(id) method.

Adding a title on your broadcasts

When your app starts broadcasting you can add give it a title. The title will be included in the broadcast metadata you get from the API. When using the API, the titleContains option lets you search for broadcasts having a specific title.

Using hashtags

If your title contains hashtags, we will use those to create individual tags and place them on your broadcast. Those tags will be included in the broadcast metadata you get from the API. Use the hasAnyTags or hasAllTags options in the API to search for broadcasts with tags.

iOS example

[bambuserView setBroadcastTitle:@"Test broadcast #testing"];

Android example

mBroadcaster.setTitle("Test broadcast #testing");

Hashtags

In the examples above, we would pick up #testing from the title and turn it into a tag. The response from the broadcast metadata API would then show the tags in a list {"tags": [{"text": "testing"}]}. The title will be left as-is.

Setting the author of your broadcasts

Your app probably has many users and you want to make sure you can tell which of your broadcasts were made by each user. The easiest way of doing that is by having your app define the author for each broadcast. The author will be included in the broadcast metadata you get from the API. Use the byAuthors option to search for broadcasts by a specific author (or a list of authors).

iOS example

[bambuserView setAuthor:@"John Smith"];

Android example

mBroadcaster.setAuthor("John Smith");

Enabling geolocation

If you want to keep track of your broadcasts geographical location, simply enable geo positioning. The position will be included as separate lat and lon values in the broadcast metadata you get from the API.

iOS example

[bambuserView setSendPosition:YES];

Android example

mBroadcaster.setSendPosition(true);

Attaching additional metadata

You may add any additional data, structured as you prefer (for example JSON or XML), in a custom string attached to each broadcast. The data you insert will be exposed by the broadcast metadata API in a property named customData.

iOS example

[bambuserView setCustomData:@"any custom metadata you want to attach and parse later"];

Android example

mBroadcaster.setCustomData("any custom metadata you want to attach and parse later");

Server-side archiving

By default, all broadcasts are stored on the Bambuser backend, to support later on-demand viewing. You may override this behaviour in the broadcasting apps if you are only interested in live content.

Note

When server-side archiving is disabled, the Bambuser backend does not store the broadcast content at all. Such broadcasts can only be accessed live through the API and video player, then they are gone.

iOS

Disable server-side archiving by setting the BambuserView saveOnServer property to NO.

Android

Disable server-side archiving by calling Broadcaster setSaveOnServer(false).

Local copy of broadcast

Due to constantly changing mobile network conditions around the broadcaster, a live broadcast will usually vary both in frame rate and video resolution. In parallel with the live broadcast, the broadcaster SDKs for Android and iOS can store a full quality video file locally, independent of network conditions.

iOS

Use the BambuserView saveLocally and localFilename properties to store a video file on the device.

Android

Use the Broadcaster storeLocalMedia(File, LocalMediaObserver) method and LocalMediaObserver interface to store a video file on the device. Your app may need the WRITE_EXTERNAL_STORAGE permission.

Taking pictures

In addition to live broadcasting, the SDKs for Android and iOS have basic functionality for taking still pictures.

iOS

The iOS broadcast SDK supports taking simple snapshots at the currently active camera resolution. See the takeSnapshot method.

Android

The Android broadcast SDK supports storing high resolution pictures or simple snapshots to files through the takePicture(File, Resolution, PictureObserver) method. A list of supported picture resolutions is available through the getSupportedPictureResolutions() method.

Broadcast dimensions

The SDKs support setting the maximum broadcast dimensions and optionally enforcing a specific aspect ratio, e.g. 16:9. This is especially useful on Android, where manufacturers offer very different cameras with different supported resolutions.

iOS

The currently default maximum video resolution used for live broadcasting is 1280x720. If you want to conserve bandwidth, you can set a lower value through the BambuserView maxBroadcastDimension property.

If you want to enforce a specific aspect ratio, e.g. 16:9, 4:3 or 1:1, see the setOrientation: previewOrientation: withAspect: by: method and previewFrame property.

Android

The currently default camera resolution is 1280x720, but never higher than the camera supports. Older or slower devices may offer for example 640x480.

Optionally use getSupportedResolutions() to see which resolutions the current camera supports, then apply a suitable resolution through the setResolution(width, height) method.

The default maximum video resolution used for live broadcasting is 960x540 and the maximum supported is currently 1280x720. If you want to raise or lower the limit, see the setMaxLiveResolution() method.

If you want to enforce a specific aspect ratio, e.g. 16:9, 4:3 or 1:1, see the Broadcaster setRotation(preview, capture, width, height) and SurfaceViewWithAutoAR setCropToParent(crop) methods.

Before starting a broadcast, you can optionally do an uplink speed test to determine whether the current network is fast enough for streaming to the Bambuser servers.

iOS

The BambuserView will do an uplink speed test automatically after initialization. Implement the BambuserViewDelegate uplinkTestComplete delegate method to get the results whenever an uplink speed test is completed. Optionally invoke the BambuserView startLinktest method to initiate uplink speed tests manually.

Android

Implement the UplinkSpeedObserver interface and call Broadcaster setUplinkSpeedObserver(observer) to enable automatic uplink speed testing and get the results whenever an uplink speed test is completed. Optionally invoke the Broadcaster startUplinkTest() method to initiate uplink speed tests manually.

While broadcasting live, you can instead observe the stream health, measured automatically at regular intervals by the broadcast library.

iOS

Implement the BambuserViewDelegate healthUpdated delegate method to observe the stream health while broadcasting.

Android

Implement the onStreamHealthUpdate method in the Broadcaster.Observer interface to observe the stream health while broadcasting.

Additional camera features

The broadcast SDKs for Android and iOS offer simple APIs to use camera functionality such as focusing, zooming and toggling a LED torch.

iOS

The BambuserView automatically uses continuous auto-focus. Check the hasLedTorch and maxZoom properties to determine available features on the current device, then use the torch and zoom properties to apply desired values.

Android

The Broadcaster by default uses continuous auto-focus on modern devices that support it. Check the hasFocus() method to determine whether the current camera supports focusing, then use the focus() method to toggle between continuous auto-focus and focus locked.

Check the hasZoom(), getZoomRatios() and hasTorch() methods to determine what the current camera supports. Use the setZoom(zoom) and toggleTorch() methods to apply desired values.

Text and audio feedback

The Bambuser Content Manager lets moderators chat or initiate a voice talkback session to the broadcaster. The broadcast SDKs for Android and iOS, which the Bambuser broadcaster apps build upon, come with built-in support for both incoming text and audio talkback.

Incoming text can be be shown in a broadcasting app either by using the provided example chat UI or designing your own. Voice talkback can be integrated by implementing a simple API available in the SDKs, as shown in the example code included in the SDKs.