ONVIF Client protocol Profile S (Live Streaming) Dart implementation.
This is a wrapper to ONVIF protocol which allows you to get information about your NVT (network video transmitter) device, its media sources, control PTZ (pan-tilt-zoom) movements and manage presets. It will also allow you to get information about your NVR (network video recorder).
Getting Started
In your project add the dependency:
dependencies:
...
easy_onvif: ^0.0.15
For help getting started with dart, check out these guides.
Usage Example
Import the easy_onvif library.
import 'package:easy_onvif/onvif.dart';
Connecting to an Onvif device
var onvif =
Onvif(host: '[your onvif device ip]', username: '[theUser]', password: '[thePassword]');
await onvif.initialize();
Interacting with the device through Onvif operations
Refer to the tables below for the supported operations.
Through the deviceManagement
operations you can get information about the connected device.
var deviceInfo = await onvif.deviceManagement.getDeviceInformation();
print(deviceInfo.model);
Many operations require you to supply a profileToken
which can be retrieved through media
operations.
var profiles = await onvif.media.getProfiles();
profiles.forEach((element) {
print(element.name + ' ' + element.token);
});
var profileToken = profiles[0].token;
With the ptz
operations you can get a list of camera presets from the connected device.
var presets = await onvif.ptz.getPresets(profileToken);
//get a specific preset
var preset = presets[11];
//print the preset values
print(
'preset: ${preset.position.panTilt?.x} ${preset.position.panTilt?.y} ${preset.position.zoom?.x}');
//use the GotoPreset operation to point the camera to the given preset
await onvif.ptz.gotoPreset(profileToken, preset);
Be sure to look through the API Reference for information about the parameters required for the supported Onvif operations.
Supported Onvif Operations
Device Management:
Onvif Operation | Dart Method | Dart Return Type |
---|---|---|
GetCapabilities | getCapabilities | Future<Capabilities> |
GetDeviceInformation | getDeviceInformation | Future<GetDeviceInformationResponse> |
GetHostname | getHostname | Future<HostnameInformation> |
GetNetworkProtocols | getNetworkProtocols | Future<List<NetworkProtocol>> |
GetNtpResponse | getNtpResponse | Future<NtpInformation> |
GetServices | getServices | Future<List<Service>> |
GetSystemDateAndTime | getSystemDateAndTime | Future<SystemDateAndTime> |
GetSystemUris | getSystemUris | Future<GetSystemUrisResponse> |
GetUsers | getUsers | Future<List<User>> |
Media:
Onvif Operation | Dart Method | Return Type |
---|---|---|
GetAudioSources | getAudioSources | Future<AudioSource> |
GetProfiles | getProfiles | Future<List<Profile>> |
GetSnapshotUri | getSnapshotUri | Future<MediaUri> |
GetStreamUri | getStreamUri | Future<MediaUri> |
GetVideoSources | getVideoSources | Future<VideoSources> |
StartMulticastStreaming | startMulticastStreaming | Future<void> |
StopMulticastStreaming | stopMulticastStreaming | Future<void> |
PTZ:
Onvif Operation | Dart Method | Return Type |
---|---|---|
AbsoluteMove | absoluteMove | Future<void> |
ContinuousMove | continuousMove | Future<void> |
GetConfiguration | getConfiguration | Future<PtzConfiguration> |
GetConfigurations | getConfigurations | Future<List<PtzConfiguration>> |
GetPresets | getPresets | Future<List<Preset>> |
GetStatus | getStatus | Future<PtzStatus> |
GotoPreset | gotoPreset | Future<void> |
RelativeMove | relativeMove | Future<void> |
RemovePreset | removePreset | Future<void> |
SetPreset | setPreset | Future<String> |
Stop | stop | Future<void> |
PTZ Helper Methods:
Onvif Operation | Dart Method | Return Type |
---|---|---|
N/A | move | Future<void> |
N/A | moveDown | Future<void> |
N/A | moveLeft | Future<void> |
N/A | moveRight | Future<void> |
N/A | moveUp | Future<void> |
N/A | zoomIn | Future<void> |
N/A | zoomOut | Future<void> |
What's next
Device discovery is planned for the 1.x release of the library.
Libraries
- model/address
- model/analytics
- model/audioDecoderConfiguration
- model/audioEncoderConfiguration
- model/audioOutputConfiguration
- model/audioSource
- model/audioSourceConfiguration
- model/audioSourcesResponse
- model/body
- model/bounds
- model/capabilities
- model/capabilitiesResponse
- model/code
- model/configurationResponse
- model/configurationsResponse
- model/date
- model/dateTime
- model/detail
- model/device
- model/deviceInformationResponse
- model/envelope
- model/events
- model/extension
- model/getPresetResponse
- model/h264
- model/header
- model/hostnameInformation
- model/hostnameResponse
- model/i8nText
- model/media
- model/mediaUri
- model/metadataConfiguration
- model/mpeg4
- model/multicast
- model/networkProtocol
- model/networkProtocolsResponse
- model/ntp
- model/ntpInformation
- model/ntpResponse
- model/panTilt
- model/panTiltLimits
- model/preset
- model/probe/appSequence
- model/probe/endpointReference
- model/probe/probeMatch
- model/probe/probeMatches
- model/profile
- model/profilesResponse
- model/ptz
- model/ptzConfiguration
- model/ptzPosition
- model/ptzSpeed
- model/ptzStatus
- model/rateControl
- model/reason
- model/resolution
- model/root
- model/service
- model/servicesResponse
- model/setPresetResponse
- model/space
- model/space1d
- model/space2d
- model/statusResponse
- model/supportedVersion
- model/system
- model/systemDateAndTime
- model/systemDateTimeResponse
- model/systemLogUris
- model/systemUrisResponse
- model/time
- model/timeZone
- model/uriResponse
- model/user
- model/usersResponse
- model/version
- model/videoAnalyticsConfiguration
- model/videoEncoderConfiguration
- model/videoSourceConfiguration
- model/videoSources
- model/videoSourcesResponse
- model/zoom
- model/zoomLimits
- onvif
- ONVIF Client Implementation in Dart