BlackBerry Spark Communications Services for iOS  1.9.0
BBMMediaManager Class Reference

BBMEnterprise Voice/Video Chat API. More...

Inheritance diagram for BBMMediaManager:

Instance Methods

(BOOL) - startWithLogPath:
 
(BOOL) - start
 
(BOOL) - stop
 
(void) - addDelegate:
 
(void) - removeDelegate:
 
(void) - requestMediaPermissionsWithCallback:mode:
 
(void) - setAllowCelluarCalls:
 
(void) - callRegId:mediaMode:callback:
 
(BBMMediaError- acceptCall
 
(BBMMediaError- answer
 
(BBMMediaError- decline
 
(BBMMediaError- hangup
 
(BBMMediaError- setMutingEnabled:
 
(BOOL) - setSpeakerPhoneEnabled:
 
(void) - toggleOutgoingVideo:
 
(void) - disableOutgoingVideo
 
(void) - toggleCamera
 
(void) - addVideoPresenter:
 
(void) - removePresenter:
 
(void) - stopRingtones
 
(void) - startDataConnection:metaData:callback:
 
(BBMDataConnection *) - dataConnectionWithIdentifier:
 
(BBMMediaError- endDataConnection:
 
(BBMMediaError- dataConnectionSetupComplete:
 
(BBMMediaError- acceptDataConnection:
 

Protected Types

typedef void(^ MediaPermissionsCallback) (BOOL granted)
 Callback invoked when media permissions are granted or denied by the user. More...
 

Properties

BBMCallcurrentCallInfo
 Returns the information for the currently active call. nil if no call exists. Observable. More...
 
BOOL isOnSpeakerPhone
 YES if we're on speaker phone. More...
 
BOOL canCall
 YES if we can place a call. More...
 
BOOL isVoiceCallingEnabled
 YES if voice calling is enabled. More...
 
BOOL isSecureCallingEnabled
 YES if secure calling is enabled. More...
 
BOOL toggleCameraAllowed
 YES if we can currently toggle the camera. More...
 
BOOL enableCameraAllowed
 YES if we can currently enable the camera. More...
 
BOOL acquiringVideo
 YES if we are currently aquiring the outgoing video feed. More...
 
UIView< BBMVideoView > * incomingVideoView
 The remote video render surface. nil if there is no incoming video. More...
 
UIView< BBMVideoView > * outgoingVideoView
 The local video render surface. nil if there is no outgoing video. More...
 
BOOL isVideoCallingSupported
 YES if video call is supported. More...
 
int cameraCount
 The number of available cameras. More...
 
MediaMode currentCallMode
 The current call mode. More...
 
NSURL * incomingRingtone
 
NSURL * outgoingRingtone
 
NSURL * callEndTone
 

Detailed Description

BBMEnterprise Voice/Video Chat API.

Note that if using BBME interfaces, the noted properties are ObservableMonitor-compliant. You can monitor via ObservableMonitor, KVO directly, or implement the corresponding delegate methods.

A shared instance of the BBMMediaManager must be obtained via [BBMEnterpriseService mediaManager];

Since
R3

Member Typedef Documentation

◆ MediaPermissionsCallback

- MediaPermissionsCallback
protected

Callback invoked when media permissions are granted or denied by the user.

Since
R3

Method Documentation

◆ acceptCall()

- (BBMMediaError) acceptCall

Accept an incoming call. This does not answer the call, but moves the call into the ACCEPTED state. This would typically be used to filter calls if needed. The incoming ringer will start only once the call is accepted.

Warning
IMPORANT: When using CallKit to handle incoming calls, the call MUST NOT BE ACCEPTED EARLY. You should accept and answer the call in sequence in the CallKit answer action callback. Calling the accept earlier than this can result in problems with audio handling.
Returns
BBMMediaError Result
Since
R3

◆ acceptDataConnection:()

- (BBMMediaError) acceptDataConnection: (BBMDataConnection *)  dataConnection

Accepts an incoming data connection. On success, the delegates will receive an incomingDataSessionAccepted callback.

Parameters
dataConnectionThe dataConnection to accept
Returns
BBMMediaError
Since
R5

◆ addDelegate:()

- (void) addDelegate: (id< BBMMediaDelegate >)  delegate

Registers a BBMMediaDelegate to receive callbacks. Multiple delegates can be registered. Utilizes weak storage internally. There is no need to deregistered deallocated delegates.

Since
R3

◆ addVideoPresenter:()

- (void) addVideoPresenter: (id< BBMMediaVideoPresenter >)  presenter

Register a video presenter. See BBMMediaVideo presenter.

Since
R3

◆ answer()

- (BBMMediaError) answer

Answer an incoming call. The call should be in the ACCEPTED state. This will (if successful) move the call to the CONNECTED state.

Note
If using CallKit, you MUST wait until you get the provider:didActivateAudioSession: callback from the CXProviderDelegate to answer incoming calls. Do not call this immediatly upon the provider:performAnswerCallAction: callback.
Returns
BBMMediaError Result
Since
R3

◆ callRegId:mediaMode:callback:()

- (void) callRegId: (NSNumber *)  regId
mediaMode: (MediaMode mode
callback: (void(^)(BBMMediaError))  callback 

Initiate a call with the supplied regId and the mode. This method is asynchronous as it requires a lookup of the users PIN. If a suitable pin cannot be found, the callback will be called with BBMV_ERRCODE_INVALID_STATE.

Parameters
regIdThe registration ID of the user to call.
modeThe desired mode (voice or video).
callbackA callback to be called when the call is placed or fails
Since
R3

◆ dataConnectionSetupComplete:()

- (BBMMediaError) dataConnectionSetupComplete: (BBMDataConnection *)  dataConnection

Incoming data connections will first be presented in the offering state. At this point, you must ensure that the user keys for the remote party are synchronized. Once this is complete, this method should be called to proceed to the 'available' state.

◆ dataConnectionWithIdentifier:()

- (BBMDataConnection *) dataConnectionWithIdentifier: (NSInteger)  callId

Get the data connection with the given callId. Returns nil if the connection does not exist.

Parameters
callIdThe call identifier
Returns
BBMDataConnection The associated connection
Since
R5

◆ decline()

- (BBMMediaError) decline

Decline an incoming call. The call should be in the ACCEPTED state. This will (if successful) move the call to the DISCONNECTED state.

Returns
BBMMediaError Result
Since
R3

◆ disableOutgoingVideo()

- (void) disableOutgoingVideo

Disables the outgoing video feed

Since
R3

◆ endDataConnection:()

- (BBMMediaError) endDataConnection: (BBMDataConnection *)  dataConnection

End the dataConnection. This will terminate all in-progress transfers

Parameters
dataConnectionThe connection to end
Returns
BBMMediaError Result
Since
R5

◆ hangup()

- (BBMMediaError) hangup

Terminates and active call. The call should be in the CONNECTED state. This will (if successful) move the call to the DISCONNECTED state.

Returns
BBMMediaError Result
Since
R3

◆ removeDelegate:()

- (void) removeDelegate: (id< BBMMediaDelegate >)  delegate

Deregister a delegate. Delegates are removed automatically on deallocation.

Parameters
delegateThe delegate to remove.
Since
R3

◆ removePresenter:()

- (void) removePresenter: (id< BBMMediaVideoPresenter >)  presenter

Removes a video presenter. Video presenters are are weakly stored and will be removed upon deallocation.

Since
R3

◆ requestMediaPermissionsWithCallback:mode:()

- (void) requestMediaPermissionsWithCallback: (MediaPermissionsCallback callback
mode: (MediaMode mode 

Request permission for video will request permission for Audio first if needed. This should be invoked before placing or answering any call. The callback is asynchronous and will be run on the UI thread. Note that iOS 10 requires you to set up the correct notification strings in your application plist.

Parameters
callbackThe callback to be invoked on success or failure.
modeThe mode (video or voice) to request permission for.
Since
R3

◆ setAllowCelluarCalls:()

- (void) setAllowCelluarCalls: (BOOL)  allow

Enable or disable BBM calling over a cellular connection (ie: limit calls to Wifi only)

Parameters
allowSet to NO to disallow calls when there is no Wifi connection. Default is YES.
Since
R3

◆ setMutingEnabled:()

- (BBMMediaError) setMutingEnabled: (BOOL)  muted

Change the mute state for the currently active call. May be called at any time.

Returns
BBMMediaError Result. The state will be updated asynchronously via the delegate
Since
R3

◆ setSpeakerPhoneEnabled:()

- (BOOL) setSpeakerPhoneEnabled: (BOOL)  enabled

Change the state of the speaker phone. This may have no effect if the user has a headset plugged in.

Returns
BOOL Result. YES if the command succeeded.
Since
R3

◆ start()

- (BOOL) start

Starts the media service. Before placing or receiving calls, start must be called.

Since
R11

◆ startDataConnection:metaData:callback:()

- (void) startDataConnection: (NSNumber *)  regId
metaData: (NSString *)  metaData
callback: (void(^)(BBMDataConnection *, BBMMediaError))  callback 

Initiate a dataConnection with the user with the given regId. The callback will be invoked once the connection has started. This does not indicate that a session is ready or availble. To monitor sessions, implement the MediaDelegate protocol and look for dataSesssionInitiated events.

Note
The number of outgoing data connections is not limited nor are you limted to one data connection per user as you are with an outgoing call. This method will attempt to start a data connection each time it is invoked.
Parameters
regIdThe registrationId of the remote party
metaDataMeta data associated with the connection
callbackCalled on success/failure of connection setup
Since
R5

◆ startWithLogPath:()

- (BOOL) startWithLogPath: (NSString *)  DEPRECATED_ATTRIBUTE

Starts the media service. Before placing or receiving calls, start or startWithLogPath must be called.

Parameters
logPathThe path for log file output. Setting this to nil will use the the default log location.
Since
R3
Deprecated:
R11 Use start

◆ stop()

- (BOOL) stop

Stops the media service

Since
R3

◆ stopRingtones()

- (void) stopRingtones

Stops the incoming and outgoing ring-tones if they are currently playing.

Since
R4

◆ toggleCamera()

- (void) toggleCamera

Cycles to the next available camera

Since
R3

◆ toggleOutgoingVideo:()

- (void) toggleOutgoingVideo: (BOOL)  enableSpeakerIfNeeded

Toggles the outgoing video feed between active and inactive. Implement BBMMediaVideoPresnter to drive updates to the UI.

Parameters
enableSpeakerIfNeededIf set to YES, will automatically enable the speaker with the video.
Since
R3

Property Documentation

◆ acquiringVideo

- (BOOL) acquiringVideo
readatomicassign

YES if we are currently aquiring the outgoing video feed.

Note
Observable
Since
R8

◆ callEndTone

- (NSURL*) callEndTone
readwritenonatomicassign

Set a tone to be played when calls disconnect. This should be a simple, short tone. If no ringtone is set, you must handle the ringer yourself. It is strongly suggested that you set this tone.

Since
R3

◆ cameraCount

- (int) cameraCount
readatomicassign

The number of available cameras.

Since
R3

◆ canCall

- (BOOL) canCall
readatomicassign

YES if we can place a call.

Note
Observable.
Since
R3

◆ currentCallInfo

- (BBMCall*) currentCallInfo
readatomicassign

Returns the information for the currently active call. nil if no call exists. Observable.

Since
R3

◆ currentCallMode

- (MediaMode) currentCallMode
readatomicassign

The current call mode.

Since
R3

◆ enableCameraAllowed

- (BOOL) enableCameraAllowed
readatomicassign

YES if we can currently enable the camera.

Note
Observable
Since
R3

◆ incomingRingtone

- (NSURL*) incomingRingtone
readwritenonatomicassign

Set an incoming ringtone. Ringtones should be less than 4 seconds in length. If no ringtone is set, you must handle the ringer yourself. Typically one would not set this if using iOS CallKit which will handle ringtone playback on your behalf.

Since
R3

◆ incomingVideoView

- (UIView<BBMVideoView>*) incomingVideoView
readatomicassign

The remote video render surface. nil if there is no incoming video.

Note
Observable (Starting R4)
Since
R3

◆ isOnSpeakerPhone

- (BOOL) isOnSpeakerPhone
readatomicassign

YES if we're on speaker phone.

Note
Observable
Since
R3

◆ isSecureCallingEnabled

- (BOOL) isSecureCallingEnabled
readatomicassign

YES if secure calling is enabled.

Since
R3

◆ isVideoCallingSupported

- (BOOL) isVideoCallingSupported
readatomicassign

YES if video call is supported.

Since
R3

◆ isVoiceCallingEnabled

- (BOOL) isVoiceCallingEnabled
readatomicassign

YES if voice calling is enabled.

Since
R3

◆ outgoingRingtone

- (NSURL*) outgoingRingtone
readwritenonatomicassign

Set an outgoing ringtone (Callback tone). Ringtones should be less than 4 seconds in length. If no ringtone is set, you must handle the ringer yourself. It is strongly suggested that you set this particular tone.

Since
R3

◆ outgoingVideoView

- (UIView<BBMVideoView>*) outgoingVideoView
readatomicassign

The local video render surface. nil if there is no outgoing video.

Note
Observable (Starting R4)
Since
R3

◆ toggleCameraAllowed

- (BOOL) toggleCameraAllowed
readatomicassign

YES if we can currently toggle the camera.

Note
Observable.
Since
R3