callGetLivePreviewCommand    
  Return
You can get the newest frame in a CoroutineScope like this:
callGetLivePreviewCommand(endpoint)
    .collect { byteReadPacket ->
        if (isActive) {
            // Read byteReadPacket
        }
        byteReadPacket.release()
    }Content copied to clipboard
Parameters
endpoint
Endpoint of Theta web API
Throws
can not get preview frames
java.net.ConnectException   
can not connect to target endpoint
ConnectTimeoutException  
timeout to connect target endpoint
RedirectResponseException  
target response 3xx status
ClientRequestException  
target response 4xx status
ServerResponseException  
target response 5xx status
suspend fun callGetLivePreviewCommand(endpoint: String, frameHandler: suspend (Pair<ByteArray, Int>) -> Boolean)
Parameters
endpoint
Endpoint of Theta web API
frameHandler 
Callback function for each JPEG data. If it returns false, this function exits.
Throws
can not get preview frames
java.net.ConnectException   
can not connect to target endpoint
ConnectTimeoutException  
timeout to connect target endpoint
RedirectResponseException  
target response 3xx status
ClientRequestException  
target response 4xx status
ServerResponseException  
target response 5xx status