libbambuser  0.9.23
Instance Methods | Properties | List of all members
BambuserView Class Reference

#import <libbambuser.h>

Instance Methods

(id) - initWithPreset:
 
(id) - initWithPreparePreset:
 
(void) - startCapture
 
(void) - startBroadcasting
 
(void) - stopBroadcasting
 
(void) - displayMessage:
 
(BOOL) - setVideoQualityPreset:
 
(void) - setOrientation:previewOrientation:
 
(void) - setOrientation:previewOrientation:withAspect:by:
 
(void) - setFramerate:minFramerate:
 
(void) - swapCamera
 
(void) - takeSnapshot
 
(void) - acceptTalkbackRequest:
 
(void) - declineTalkbackRequest:
 
(void) - endTalkback
 
(void) - startLinktest
 

Properties

id delegate
 Property for setting delegate to receive BambuserViewDelegate callbacks.
 
NSString * applicationId
 
UIView * chatView
 
BOOL canStart
 
enum AudioQuality audioQualityPreset
 
BOOL saveOnServer
 
BOOL saveLocally
 
BOOL talkback
 
BOOL talkbackMix
 
NSString * localFilename
 
BOOL sendPosition
 
NSString * author
 
NSString * broadcastTitle
 
NSString * customData
 
UIInterfaceOrientation orientation
 
UIInterfaceOrientation previewOrientation
 
BOOL torch
 
BOOL hasLedTorch
 
BOOL hasFrontCamera
 
int health
 
enum TalkbackState talkbackState
 
float zoom
 
float maxZoom
 
float framerate
 
float minFramerate
 
float uplinkSpeed
 
BOOL uplinkRecommendation
 
int maxBroadcastDimension
 
CGRect previewFrame
 
AVCaptureDevicePosition cameraPosition
 

Detailed Description

This is the main class for using the broadcasting library.

Method Documentation

- (void) acceptTalkbackRequest: (int)  talkbackID

This method is used to accept a pending talkback request. The talkbackID should previously have been supplied by the delegate protocol method talkbackRequest:caller:talkbackID: (BambuserViewDelegate-p).

Parameters
talkbackIDThe talkbackID supplied in a previous talkback request during ongoing broadcast
- (void) declineTalkbackRequest: (int)  talkbackID

This method is used to reject a pending talkback request. The talkbackID should previously have been supplied by the delegate protocol method talkbackRequest:caller:talkbackID: (BambuserViewDelegate-p).

Parameters
talkbackIDThe talkbackID supplied in a previous talkback request during ongoing broadcast
- (void) displayMessage: (NSString *)  message

Display the supplied string message in chatView.

Parameters
messageA string containing the message to be displayed in chatView.
- (void) endTalkback

This method is used to end an ongoing talkback session.

- (id) initWithPreparePreset: (NSString *)  preset

Used to initialise the bambuserView. This method should be called with one of the kSessionPreset* video preset constants declared in BambuserConstants.h. This method does not start capture immediately, but allows you to set other capture related parameters directly, before starting the capture. If initializing with this method, you must call startCapture immediately afterwards, after setting all the capture related properties.

Parameters
presetPreferred kSessionPreset-value from BambuserConstants.h. Default is kSessionPresetAuto.
Returns
Returns the BambuserView object
- (id) initWithPreset: (NSString *)  preset

Used to initialise the bambuserView. This method should be called with one of the kSessionPreset* video preset constants declared in BambuserConstants.h.

Parameters
presetPreferred kSessionPreset-value from BambuserConstants.h. Default is kSessionPresetAuto.
Returns
Returns the BambuserView object
Deprecated:
Use initWithPreparePreset: instead.
- (void) setFramerate: (float)  framerate
minFramerate: (float)  minFramerate 

This method allows setting the minimum framerate of the capture, in addition to the maximum framerate.

The minimum framerate only affects the capture from the camera itself; the actual streamed framerate may be lower. This restricts the camera, not allowing it to lower the framerate even if it would be needed to get better exposure (e.g. in low light conditions). Default framerate is 30 and minFramerate is 15.

- (void) setOrientation: (UIInterfaceOrientation)  orientation
previewOrientation: (UIInterfaceOrientation)  previewOrientation 

Sets the preview orientation independently from the capture orientation.

The previewOrientation parameter should be the orientation mode used for the application UI where the preview is shown. This allows e.g. keeping the UI locked in one orientation while capturing in an orientation depending on how the device is held.

- (void) setOrientation: (UIInterfaceOrientation)  orientation
previewOrientation: (UIInterfaceOrientation)  previewOrientation
withAspect: (int)  w
by: (int)  h 

Sets the preview orientation independently from the capture orientation.

The previewOrientation parameter should be the orientation mode used for the application UI where the preview is shown. This allows e.g. keeping the UI locked in one orientation while capturing in an orientation depending on how the device is held. This method additionally takes integers for width and height, to set aspect ratio for the captured video. Note that the captured video is cropped to fit this ratio, so edges of your preview might not be in the broadcast video. Vice versa, parts not visible in the preview might appear in the broadcast video. To avoid this, make sure to set the preview frame to the same aspect ratio using the previewFrame property.

- (BOOL) setVideoQualityPreset: (NSString *)  preset

Sets a video quality preset for the upcoming Bambuser session. This method should not be called during a broadcast.

The only valid value for this parameter is kSessionPresetAuto.

The preset kSessionPresetAuto will allow the video quality to dynamically be adjusted depending on the connection quality.

The default value is kSessionPresetAuto.

Deprecation: Some constants from AVCaptureSession.h were previously used. These are still valid for backwards compatibility.

Parameters
presetA video input preset as declared in BambuserConstants.h.
Returns
YES if the session could apply the preset, otherwise NO.
- (void) startBroadcasting

Connects to the Bambuser video server and starts a new broadcast. This method should not be called if the library is trying to connect or is already connected. It is advisable to check the canStart property before calling this method.

- (void) startCapture

Start capturing with the properties set.

If the initWithPreparePreset: method was called, this method should be called immediately after all properties that are going to be set upfront have been set. This must have been called before calling startBroadcasting.

This method should only be called once.

- (void) startLinktest

This method is used to manually start a linktest. The result will be returned through the uplinkTestComplete:recommendation: (BambuserViewDelegate-p) method. A valid applicationId must be set before linktests can be performed.

- (void) stopBroadcasting

Stops the broadcast and disconnects from the Bambuser video server. This method can be called at any time.

- (void) swapCamera

For devices with more than one camera this method can be used to toggle between these cameras. This method can be called at any time.

See also
cameraPosition
- (void) takeSnapshot

Request a snapshot be returned from the camera. The resulting UIImage will be returned through the snapshotTaken: (BambuserViewDelegate-p) method.

Property Documentation

- (NSString*) applicationId
readwritenonatomicretain

This property should hold your application ID. Depending on serverside setup this ID can redirect you to a suitable ingest server, and automatically set your broadcasting credentials.

This property shall be set before calling startBroadcasting and can not be altered during a broadcast.

- (enum AudioQuality) audioQualityPreset
readwritenonatomicassign

This property sets the audio quality preset for the upcoming bambuser broadcast. This property can not be changed during an ongoing broadcast. Constants are defined in BambuserConstants.h for the possible values of this property.

- (NSString*) author
readwritenonatomicretain

Contains the author field which will be associated with the broadcast.

This can be any arbitrary string that should be associated with the broadcast. This property should be set before calling startBroadcasting.

- (NSString*) broadcastTitle
readwritenonatomicretain

Sets the title for an upcoming broadcast, or updates the title for an ongoing broadcast. This property can be altered at any time.

- (AVCaptureDevicePosition) cameraPosition
readwritenonatomicassign

Property to set camera used, AVCaptureDevicePositionBack or AVCaptureDevicePositionFront. AVCaptureDevicePositionBack is default. If AVCaptureDevicePositionUnspecified is set it has no effect.

See also
- swapCamera
- (BOOL) canStart
readnonatomicassign

This property is YES if the startBroadcasting method can be called. If the library is connecting or already is connected this method will return NO.

- (UIView*) chatView
readwritenonatomicretain

This property presents a scrollable view for displaying chat messages. See documentation for UIView for styling the view with background color, alpha and frame.

- (NSString*) customData
readwritenonatomicretain

Can be set to an arbitrary string that will be associated with the broadcast.

This property can be set before broadcasting and updated during the broadcast.

Note: This field is currently limited to 10000 bytes serverside.

- (float) framerate
readwritenonatomicassign

This property allows setting the maximum capture framerate, within a range from 24 to 30 fps. Default framerate is 30.

- (BOOL) hasFrontCamera
readnonatomicassign

This readonly property will be YES if the device has a front-facing camera.

- (BOOL) hasLedTorch
readnonatomicassign

This readonly property will be YES if the device has an LED torch.

- (int) health
readnonatomicassign

This readonly property returns a value between 0 and 100, indicating the current stream health.

A value of 0 indicates that the connection is unable to keep up with transferring all data currently being generated. A value of 100 indicates that the connection is able to send all the data currently being generated.

This method will return 0 when not broadcasting.

- (NSString*) localFilename
readwritenonatomicretain

This property can be set if you want to set a specific file path when saving a local copy of your broadcast. If this value is nil the local copy will be saved with a unique filename in the sandbox's NSTemporaryDirectory(). This property can not be altered during an ongoing broadcast.

See also
saveLocally
- recordingComplete: (BambuserViewDelegate-p)
- (int) maxBroadcastDimension
readwritenonatomicassign

Sets the max size for any dimension (width, height) when using the auto quality preset (kSessionPresetAuto).

This can be used to conserve bandwidth while using a higher camera video resolution, for example when a high resolution local copy is desired.

Accepted values range from 200 to 1280. Default value is 0, which will give the maximum camera resolution. Currently it is 1280x720 in landscape mode and 720x1280 in portrait mode.

The live broadcast resolution will not be higher than the set limit, not higher than the actual camera video resolution and will still be automatically adjusted depending on current network conditions. This method only sets an upper bound.

For instance, if maxBroadcastDimension is set to 640, the broadcast is limited to 640x360 in landscape mode, and to 360x640 in portrait mode at the default aspect ratio.

This property can not be altered during a broadcast.

- (float) maxZoom
readnonatomicassign

This readonly property returns the highest value accepted for the zoom property.

A negative value indicates that the device does not support zooming.

- (float) minFramerate
readnonatomicassign

This property indicates the minimum framerate.

This property is read-only, it can be set via setFramerate:minFramerate:.

- (UIInterfaceOrientation) orientation
readwritenonatomicassign

This property determines the orientation the video will be recorded in.

This property can be set to the UIInterfaceOrientation* constants from UIKit/UIApplication.h. The default value is UIInterfaceOrientationLandscapeRight.

During a broadcast, it can only be set to flipped versions of the same orientation (i.e. switching from UIInterfaceOrientationLandscapeRight to UIInterfaceOrientationLandscapeLeft).

- (CGRect) previewFrame
readwritenonatomicassign

Property to set a custom rectangle with the desired location and dimensions for the preview view.

- (UIInterfaceOrientation) previewOrientation
readnonatomicassign

This property determines the orientation of the application UI, making sure that the camera picture on the screen is rotated correctly.

This property is read-only - setting the orientation property sets this to the same value. See setOrientation:previewOrientation: in order to change it.

- (BOOL) saveLocally
readwritenonatomicassign

When this property is YES, the next broadcast will also be saved to a local file. If a path is set in localFilename, the file gets written in that path, otherwise the file gets a unique filename assigned and is stored within the sandbox's NSTemporaryDirectory(). This property can not be altered during an ongoing broadcast.

See also
localFilename
- recordingComplete: (BambuserViewDelegate-p)
- (BOOL) saveOnServer
readwritenonatomicassign

When this property is YES, the next broadcast will signal the Bambuser video server that the broadcast should be available on demand when the live broadcast is over. This property can not be altered during an ongoing broadcast.

- (BOOL) sendPosition
readwritenonatomicassign

When this property is YES, the location of the device will be sent continuously during the next broadcast. This property can not be altered during an ongoing broadcast.

- (BOOL) talkback
readwritenonatomicassign

When this property is YES, the next broadcast will signal the Bambuser video server that the client is willing to accept requests for talkback. This property can not be altered during an ongoing broadcast.

- (BOOL) talkbackMix
readwritenonatomicassign

This property indicates whether the talkback audio should be mixed into the signal that gets recorded into the local copy and broadcasted. This property can not be altered during an ongoing broadcast.

- (enum TalkbackState) talkbackState
readnonatomicassign

This readonly property contains the current state of talkback.

See BambuserConstants.h for possible values.

- (BOOL) torch
readwritenonatomicassign

This property turns the LED torch on and off, if the device has one. This property can be altered at any time.

- (BOOL) uplinkRecommendation
readnonatomicassign

This property returns the current recommendation whether to broadcast or not, during an ongoing or previously performed uplink test.

If an uplink test has not yet been started, NO will be returned.

- (float) uplinkSpeed
readnonatomicassign

This property returns the current speed in bytes per second of an ongoing or previously performed uplink test.

If an uplink test has not yet been started, 0 will be returned.

- (float) zoom
readwritenonatomicassign

This property controls the current zoom level. Accepted values are in the range [1.0, maxZoom].