Breadcrumbs

PlayerApi. iOS

Api to use inside player.

Get live stream

Get camera's live stream of chosen quality.

If request was successful you'll get url to play. If any error would occur you would get an VMSApiError object.

getStream(by cameraId: Int, quality: VMSStream.QualityType, completion: (String?, VMSApiError?))

enum QualityType {
    case low
    case high
}

cancelStreamRequest(by cameraId: Int) - cancel request if you need it

Get archive stream

Get camera's archive stream.

If request was successful you'll get url to play. If any error would occur you would get an VMSApiError object.

If you need to cancel this request use cancelArchiveRequest() method with specified camera id.

getArchive(by cameraId: Int, start: Date, completion: (String?, VMSApiError?))

start - a date from which this archive should play

cancelArchiveRequest(by cameraId: Int) - cancel request if you need it

Get url to download archive

Get url to download specific part of camera's archive.

After that you'll receive socket push with VMSArchiveLinkSocket object with generated url for downloading.

If request was successful response will return nil. If any error would occur you would get an VMSApiError object.

getArchiveLink(cameraId: Int, from: Date, to: Date, completion: (VMSApiError?))

Move camera

Move camera to specific direction.

If request was successful response will return nil. If any error would occur you would get an VMSApiError object.

moveCamera(with id: Int, direction: VMSPTZDirection, completion: @escaping (VMSApiError?))

enum VMSPTZDirection {
    case up
    case down
    case left
    case right
    case zoomIn
    case zoomOut
}

Move camera to default

Move camera to initial position.

If request was successful response will return nil. If any error would occur you would get an VMSApiError object.

moveCameraHome(with id: Int, completion: (VMSApiError?))