我目前正在this youtube tutorial之后构建一个可与ONVIF IP摄像机通信的Android Things应用程序。
我可以与摄像机对话,并且可以获得服务和设备信息,但是当我尝试检索个人资料,它以D/RESPONSE: Response{protocol=http/1.1, code=500, message=Internal Server Error
响应
什么原因导致此响应?
onCreate
currentDevice = OnvifDevice("192.168.1.5","admin","password")
currentDevice.listener = this
currentDevice.getServices()
Log.d("REQUEST", "Get services");
请求执行
override fun requestPerformed(response: OnvifResponse) {
//method called when response is received from camera
Log.d("RESPONSE", response.parsingUIMessage);
if (response.request.type == OnvifRequest.Type.GetServices) {
Log.d("REQUEST", "Get device information");
currentDevice.getDeviceInformation()
}
else if (response.request.type == OnvifRequest.Type.GetDeviceInformation) {
Log.d("REQUEST", "Get profiles");
currentDevice.getProfiles()
}
else if (response.request.type == OnvifRequest.Type.GetProfiles) {
Log.d("REQUEST", "Get stream URI");
currentDevice.mediaProfiles.firstOrNull()?.let {
currentDevice.getStreamURI(it)
}
}
else if (response.request.type == OnvifRequest.Type.GetStreamURI) {
Log.d("REQUEST", "Get get video stream");
currentDevice.rtspURI?.let { uri ->
val surfaceView = findViewById<SurfaceView>(R.id.surfaceView)
vlcVideoLibrary = VlcVideoLibrary(this, this, surfaceView)
vlcVideoLibrary?.play(uri)
}
}
}
答案 0 :(得分:0)
有时候,问题不在于您编写的代码,而是您所使用的设备/相机...我的一台相机有问题...在以下情况下未返回有效响应:询问其状态。 here
我建议您寻找任何相机软件更新。如果仍然无法解决问题,我建议尝试使用另一台设备,如@sasikumar所述。