in amazon-chime-sdk/src/main/java/com/amazonaws/services/chime/sdk/meetings/internal/video/DefaultVideoClientController.kt [193:214]
override fun sendDataMessage(topic: String, data: Any, lifetimeMs: Int) {
if (!videoClientStateController.canAct(VideoClientState.STARTED)) return
val byteArray = data as? ByteArray
?: if (data is String) {
data.toByteArray()
} else {
gson.toJson(data).toByteArray()
}
if (!TOPIC_REGEX.matches(topic)) {
throw InvalidParameterException("Invalid topic")
}
if (byteArray.size > DATA_MAX_SIZE) {
throw InvalidParameterException("Data size has to be less than or equal to 2048 bytes")
}
if (lifetimeMs < 0) {
throw InvalidParameterException("The life time of the message has to be non negative")
}
videoClient?.sendDataMessage(topic, byteArray, lifetimeMs)
}