Public API (v2.0)

Make sure the links are updated

Hints:
protocol in ObjC/Swift is interface in Java; delegate in ObjC/Swift is listener in Java.
All class names in ObjC/Swift starts with prefix "CM" (i.e CMAccessTokenProvider etc).

CameraSniffer (v2.0)

====================

class CameraSniffer

Constructs CameraSniffer instance.

startSniffing();

Starts broadcasting for cloud cameras discovery.

stopSniffing();

Stops broadcasting.

Bool isSniffing();

Returns true if broadcasting is active.

Device[] getFoundDevices();

Returns list of founded devices.

protocol CameraSnifferDelegate

@required onFound(Device device);

Will get called when new camera has been detected in the network.

@required onLost(Device device);

Will get called when discovered camera don't response for broadcast message.

@required onError(MobileSDKError error);

Will get called if there's an error in the process of sniffing a camera.

class Address 

String getIp4();

Returns IP4 address of device.

String getMac();

Returns MAC address of device.

class DeviceModelInfo 

String getBrand();

Returns brand of device.

String getModel();

Returns model of device.

class Device 

Address getAddress();

Returns addresses of device.

DeviceModelInfo getModelInfo();

Returns model info of device.

Int getTypeId();

Returns type ID of device.

CameraWizard (v2.0)

class CameraWizard

CameraWizard(CameraWizardDelegate delegate);

Constructs CameraWizard instance.

addDevice(Device device, String cameraName, Long zoneId);

Adds a device to a specific zone specified by zoneId.  For mode details about Device class check CameraSniffer (v3.0) page.

protocol CameraWizardDelegate

@required onAdded(Camera camera);

If everything went ok, will get called after the camera has been added.

@required onError(MobileSDKError error, Device device);

Will get called if there's an error in the process of adding a camera.

class SystemProperties 

String getName();

Returns name of camera in system.

Int getZoneId();

Returns zone ID of camera in system.

Int getCameraId();

Returns ID of camera in system.

class Camera

Device getDevice();

Returns device info of camera. For mode details about Device class check CameraStreamer page.

SystemProperties getProperties();

Returns properties of camera.

CameraStreamer (v2.0)

Hints:

  • **In Android CameraStreamer is rendering video frames directly into Surface while in iOS CameraStreamer returns UIImage object which represents video frame.**
  • **In case of multiple CameraStreamer instances usage it's generally advised to mute audio on all or all except one CameraStreamer instances.**
  • Android specific: CameraStreamer constructor takes Surface parameter (most commonly obtained via TextureView::getSurfaceTexture() method).
  • **Android specific:** takeSnapshot() method is absent because the video decoder works directly with passed Surface object and therefore doesn't have access to raw frames. There is an easy and convenient way to take snapshot though: TextureView::getBitmap() method (the same view that holds the Surface from the previous step).

class CameraStreamer

CameraStreamer(String rtspUrlString, CameraStreamerDelegate delegate);

Constructs CameraStreamer instance.

play();

Resumes streaming: footage from pause point, live from current timestamp.

pause();

Pauses streaming (both live and footage).

seekToTime(float time);

Jumps to concrete time in [0 ... duration] range and starts playing (even if footage was paused). In milliseconds. Wouldn't affect live streaming. 

boolean isPlaying();

Returns true if the playback has been started.

boolean isLiveStreaming();

Returns true if streaming is not footage.

float getStartTime();

returns start time of footage stream (0 for live stream), in milliseconds till 1970.

float getEndTime();

returns end time of footage stream (0 for live stream), in milliseconds till 1970.

float getDuration();

returns duration of footage stream (0 for live stream), in milliseconds.

float getPosition();

returns current position in [0 ... duration] range for footage stream or current timestamp for live stream, in milliseconds.

boolean muteAudio;

mutes audio by ignoring the audio stream altogether.

byte[] takeSnapshot();

iOS specific: returns last decoded frame.

protocol CameraStreamerDelegate

@optional onStarted();

Will get called when the playback has been effectively resumed/started.

@optional onPaused();

Will get called when the playback has been paused.

@optional onSoughtToTime(float time);

Will get called when the playback has been sought to given time. 

@optional onEnded();

Will get called when the playback has been ended. Will be called only for footage stream as live stream can't end. 

@required onFrameDataReceived(UIImage frame, Double timestamp);

iOS specific: When a new frame arrives, this method will be called.

@required onError(MobileSDKError error);

Will be called if there is an error in the streaming process.

AccessTokenProvider (v2.0)

class AccessTokenProvider

static setDelegate(AccessTokenProviderDelegate delegate);

SDK will ask AccessTokenProviderDelegate to provide access token when required. You MUST set delegate before using SDK otherwise you'll get 401 (unauthorised) error.

protocol AccessTokenProviderDelegate

String getAccessToken();

Will be called each time when access token is required.

MobileSDKError (v2.0)

class MobileSDKError

Int getCode();

Returns error code.

String getGeneralMessage();

Returns general message for error.

String getDetailMessage();

Returns detail message for error.

CodeTypeGeneral message
1Internal errorAn internal error has occurred. Please try again later.
2Parsing errorThe request could not be parsed correctly.
3Validation errorThe request was not valid according to semantic rules.
4Resource not foundA resource necessary to complete this request does not exist.
5Duplicate resourceThe new resource could not be created as a resource with the same identifying information already exists.
6Business rule violationThe request violated some business rule.
7Subscription limits errorThe request could not be carried out because of a subscription limit.
8Authentication errorAuthentication failed while it is required for the request.
9Authorization errorYou are not authorized for this request.
10Unsupported operationThe request is not supported.
11Device capability not supportedThe specific resource instance does not support the requested or required capability.
12Device authentication errorCan't carry out the request as the device reports the configured user credentials are incorrect.
13Device internal errorCan't carry out the request as device reported an error or responded in an unexpected way. Please try again and/or restart the device.
14Device offline errorCan't carry out request as the device is offline.
15Server offline errorCan't reach server, request timeouted.
16Streamer errorThere was a problem with the streamer.