PTZ Control

Pre-requisite: The user has to be signed in to perform the following operations.


Operate PTZ of the Device

To move the PTZ of the device, The following method can be used:

  • device (required): The device object on which the operation has to be performed.
  • request (required): The request object containing the PTZ movement information.
val request = MoveRequest(
  pan = MoveValue.NONE.value, // The pan value of the PTZ movement
  tilt = MoveValue.UP.value, // The tilt value of the PTZ movement
  nonStop = false // If the PTZ movement should be non-stop and continue till the stopPTZ method is called
)
InstaVision.deviceServices.ptzMove(
  device = device,
  request = request,
  onSuccess = {
    // The PTZ movement was successful
  },
  onError = { error ->
    // The error object contains the error code and message
  },
)

if you have a device that is cluster based you need to pass the multiplier or the steps along with the direction.

val cluster: DeviceCluster = deviceCluster // from getDeviceCluster
val isNonStop = false; val panValue = MoveValue.LEFT.value; val tiltValue = MoveValue.NONE.value
val isFlipped = cluster.rotationAngle() != 0 // To check if the device is flipped
val panFactor =
  if (isNonStop) cluster.panStep() ?: 0 else cluster.pan() ?: -100 //-100 is a default value
val tiltFactor =
  if (isNonStop) cluster.tiltStep() ?: 0 else cluster.tilt() ?: -50 //-50 is a default value
var request = MoveRequest(
  pan = panFactor * panValue,
  tilt = tiltFactor * tiltValue
)
if (isFlipped) {
  request = request.copy(
    pan = request.pan,
    tilt = -request.tilt
  )
}
InstaVision.deviceServices.ptzMove(
  device = device,
  request = request,
  onSuccess = {
    // The PTZ movement was successful
  },
  onError = { error ->
    // The error object contains the error code and message
  },
)


Stop PTZ Movement

To stop the PTZ movement of the device, The following method can be used:

  • device (required): The device object on which the operation has to be performed.
InstaVision.deviceServices.stopPTZ(
  device = device,
  onSuccess = {
    // The PTZ movement was stopped successfully
  },
  onError = { error ->
    // The error object contains the error code and message
  },
)


Reset PTZ to default position

To reset the PTZ of the device, The following method can be used:

  • device (required): The device object on which the operation has to be performed.
InstaVision.deviceServices.resetPTZ(
  device = device,
  onSuccess = {
    // The PTZ was reset successfully
  },
  onError = { error ->
    // The error object contains the error code and message
  },
)


The video-call records (initiateVideoCall, updateVideoCallStatus) are documented with Two-Way Calling; SIM validation with Trail → Cellular / 4G.


This site uses Just the Docs, a documentation theme for Jekyll.