Closed DongsubShin closed 1 year ago
Hello @DongsubShin,
Can you let me know which version of the package you are using?
Also, if you enable debugging, and provide the debug info, that could also provide a clue as to the problem.
final onvif = await Onvif.connect(
host: config['host'],
username: config['username'],
password: config['password'],
logOptions: const LogOptions(
LogLevel.debug,
stackTraceLevel: LogLevel.error,
));
"also is there any workaround to get profile token from cctv hardward directly?" - I'm not aware of any method to do this.
Based on the error info that you've provided, it looks like the device is having a problem responding to the request. Having the debug log could help trace the issue.
/flutter (14197): 🐛 00:52:10.542713 DEBUG UI Loggy - Media - getProfiles
I/flutter (14197): 🐛 00:52:10.550331 DEBUG UI Loggy - Onvif - URI: http://183.107.70.232:9440/onvif/device_service
I/flutter (14197): 🐛 00:52:10.550574 DEBUG UI Loggy - Onvif - REQUEST:
I/flutter (14197): <?xml version="1.0" encoding="UTF-8"?>
/flutter (14197): ‼️ 00:52:10.612952 ERROR UI Loggy - Onvif - ERROR: I/flutter (14197): DioError [DioErrorType.other]: HttpException: Connection closed while receiving data, uri = http://183.107.70.232:9440/onvif/device_service
I've tested camera with other onvif apps(like Onvier). and it works well on those apps.
Flutter (Channel stable, 3.3.9, on macOS 12.3.1 21E258 darwin-arm, locale ko-KR) easy_onvif: ^2.0.13+7
Thanks :)
Hi @DongsubShin,
This looks like it might be a network related issue, but it's difficult to say with the limited information.
I recommend installing the cli utility
with the command:
dart pub global activate easy_onvif
Further instructions are available in the README - https://github.com/faithoflifedev/easy_onvif/tree/main/bin#readme quick start section.
Then check to see if the results of the onvif device-management get-services
command give the same IP address that you are using to connect to your Onvif device. The results of the command will look something like:
[
{
"Namespace": "http://www.onvif.org/ver10/device/wsdl",
"XAddr": "http://192.168.1.182/onvif/device_service",
"Version": {
"Major": 16,
"Minor": 12
},
"Capabilities": null
},
...
If the value for "XAddr"
(in the section with "Namespace": "http://www.onvif.org/ver10/device/wsdl"
) is different in terms of IP address, port or if it doesn't end in "/onvif/device_service" this could be the problem.
Hello,
I am getting a similar error during Onvif.connect or calling (onvif device-management get-device-information --log-level debug). I hope that it can be useful. Thank you
👻 14:13:50.294820 INFO UI Loggy - Onvif - initializing ...
🐛 14:13:50.297588 DEBUG UI Loggy - DeviceManagement - getSystemDateAndTime
🐛 14:13:50.313086 DEBUG UI Loggy - Onvif - URI: http://192.168.0.25/onvif/device_service
🐛 14:13:50.313162 DEBUG UI Loggy - Onvif - REQUEST:
<?xml version="1.0" encoding="UTF-8"?>
@DongsubShin, @LODYZ, are you using "Onvif Rtsp Server for Android"?
If so, issue #3 covers the problem you're experiencing.
If not, I recommend testing if other Onvif libraries work with your device (preferably open source) and let me know which works, so I can look at how others have solved the problem.
The error you're seeing in this case is a network issue where the device is dropping the connection, at this point I think I could only offer additional help if I have access to a device that allows me to recreate the problem.
Hello @faithoflifedev, no i am not using "Onvif Rtsp Server for Android".
At the Moment i have only tried the camera with onvier (an app) and It works. I Will try other libraries and update you.
Thank you for all the support!
@LODYZ are you running your code in the Android emulator? If so, this solution might help - https://learnflutter.co/flutter-connection-closed-while-receiving-data/
Hello @faithoflifedev, I'm glad to inform you that I was able to resolve the device connection problems.
I encountered 3 problems:
If you want I created a fork where you can see the changes. https://github.com/LODYZ/easy_onvif
Sorry if maybe that's not entirely correct but I'm new to the world of dart and onvif.
Hi @LODYZ,
Thanks for this. It's helped me identify a couple of bugs. It looks like there's a Media2
profile - https://www.onvif.org/ver20/media/wsdl/media.wsdl - supported by some cameras that I was unaware of, so the current code doesn't support it. I'll work on adding support in the coming days.
In digging in to this I found that all three of DeviceManagement
, Media
and Media2
use a GetServiceCapabilitiesResponse
, which returns three different Capabilities
objects. I'm currently only properly returning the Capabilities
for DeviceManagement
. So I'll try to correct this as well.
Hi @LODYZ, as an fyi, after a major overhaul of the code base, I've been able to create a new release that includes Media2 support, and fixes a number of bugs that I found in the original code base. I've published a pre-release version at easy_onvif v2.1.0-dev.3, I'd appreciate any feedback that you could offer.
Hi @faithoflifedev , thank you so much for all the work you are doing. I'll try the new release as soon as possibile.
https://github.com/faithoflifedev/easy_onvif/issues/32#issuecomment-1493346568 also deals with this issue.
always thank you about wonderful package
I've used this package very well but since last week onvif.media.getProfile doesn't work suddenly
initialize, onvif.connect, everything worked well execpt get profile what should i do?
Thank you in advance