ONVIF Profile S, Actions API, and PTZ Controls Implementation#1205
Draft
kaburagisec wants to merge 100 commits intoroflcoopter:devfrom
Draft
ONVIF Profile S, Actions API, and PTZ Controls Implementation#1205kaburagisec wants to merge 100 commits intoroflcoopter:devfrom
kaburagisec wants to merge 100 commits intoroflcoopter:devfrom
Conversation
… commit dates to the component header
✅ Deploy Preview for viseron ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
…anges of the ONVIF component
…m type description
…p and update PlayerMenu rendering logic
…lay logic in QueryWrapper
…sections with isOnvifAutoConfig
…e aware dayjs instance
✅ Deploy Preview for viseron ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TL;DR
PTZ componenthas now been switched toONVIF component.Telegram component(the PTZ control section) has been refactored to accommodate the changes to theONVIF component.Profile S(see Profile S Specs) in Viseron (starting point of ONVIF Profile G support #1166).Actions APIto connect backend and frontend component functions.PTZ Controlsare available on theLive Viewpage as aPlayerMenu(closed [FEATURE] PTZ controls #449).Camera Tuningpage (see PR Add Camera Tuning Implementation (Tuning Interface, Zone/Mask Drawer Tool, Labels Editor, OSD Texts, and Miscellaneous UI) #1165).ONVIF componentcan be used with all types of ONVIF cameras (even if the camera does not support PTZ).PR Overview
PR TODO:
ONVIF Componentbackend implementationActions APIbackend implementation forONVIF ComponentTelegram PTZ ControlforONVIF ComponentAPI Hooksin Frontend forONVIF ComponentPTZ Controlsin Frontend forONVIF ComponentCamera Tuninghandlers in the backend forONVIF ComponentCamera Tuningpage forONVIF ComponentCamera TuningpageCamera Tuning APIONVIF Profile S?
What is the Actions API?
The Actions API is a set of APIs that allow frontend components to perform specific actions on specific component functions defined in the backend that directly impact or communicate with the camera. The implementation code must conform to the following folder pattern:
viseron/components/webserver/api/v1/actions/{component_name}.The naming of the Actions API is simply a separation of focus, as the majority of the REST APIs in the webserver components are APIs for Viseron's built-in systems.
Custom Decorators
There are two main decorators introduced in this PR:
@operation: found inviseron/components/onvif/utils.pyand used to wrap all methods that implement ONVIF operations for a service. Any method that calls ONVIF operations within it is required to use this decorator.@action_handler: found inviseron/components/webserver/api/v1/actions/onvif/base.pyand used to wrap methods used by the Actions API. Because the context is an ONVIF component, the@action_handlerdecorator also communicates to determine which service will process the API request.How PTZ Controls works?
On the frontend,
PTZ Controlswill only be rendered on cameras with a non-nullptz_supportkey. This means thePTZ Controlsbutton will not appear in the player on cameras that don't support PTZ. The current implementation is to match theptz_supportkey with the available PTZ controller (referred to here as the UI component). Currently,PTZ Controlscan only be used withONVIF components. It is possible (in the future) to implementPTZ Controlsother thanONVIF components, by integrating custom components with specific brands (for example, Dahua).All PTZ operation communications must go through the
Actions APIdefined infrontend/src/lib/api/actions/{component_name}for frontend and inviseron/components/webserver/api/v1/actions/{component_name}for backend. The UI component forPTZ Controlsmust be located infrontend/src/components/actions/ptz.Tested Devices
Notes:
Notes (dev):
Camera Tuning, but why do we still need theauto_configmechanism and service key inconfig.yamlin the ONVIF component? So many cameras will reset all settings if the camera restarts/reboots, suppose there is a scenario where there is a power outage where the Viseron server and ONVIF cameras are in the same location, then the service key is very useful so that the ONVIF component in Viseron configures each camera based on the configuration that has been written when restarting (Viseron server) without the need to configure each camera one by one.ONVIF Profile S Client Requirements Checklist:
For transparency and reference of ONVIF component development, the following is a checklist based on the official requirements for Profile S client (https://www.onvif.org/wp-content/uploads/2019/12/ONVIF_Profile_-S_Specification_v1-3.pdf) implementation in ONVIF:
WS-Usernametokenaccording to WS-security as covered by the core specification.HTTP Digestas covered by the core specification.GetCapabilities.GetNetworkInterfacesandSetNetworkInterfacesoperations.If configuring a device’s network configuration is supported in any way by the client, the client shall be able to list and set the default gateway of the device using the
GetNetworkDefaultGatewayandSetNetworkDefaultGatewayoperations.GetDeviceInformationoperation.CreateUsers,GetUsers,SetUserandDeleteUsersoperations.- “Pull” using the
CreatePullPointSubscriptionandPullMessageoperations.- “Push” using
Notify,SubscribeandRenewoperations fromWSBaseNotification.GetProfilesoperation.- Client shall be able to get the stream URI for the selected profile using the
GetStreamURIoperation.- Client shall be able to stream video on RTP/UDP or RTP/RTSP/HTTP/TCP using the selected profile over RTSP.
and
🚫 out of scope
and
🚫 out of scope
- Client shall be able to understand RTSP – JPEG RTP header extension.
GetVideoEncoderConfigurationOptionsandSetVideoEncoderConfigurationoperations.GetProfilesoperation.- Client shall be able to create a media profile using the
CreateProfileoperation.GetCompatibleVideoSourceConfigurations,GetVideoSourceConfigurationOptions,SetVideoSourceConfigurationandAddVideoSourceConfigurationoperations.GetMetaDataConfigurationOptionsandSetMetaDataConfigurationoperations.GetNodesorGetNodeoperations.- Client shall be able to add a PTZ configuration to a profile using
GetConfigurationsandAddPTZConfiguration.- Client shall be able to move a PTZ device using the
ContinuousMoveoperation.- Client shall be able to stop a PTZ device using the
Stopoperation.AbsoluteMoveoperation.RelativeMoveoperation.GetPresetsoperation.- Client shall be able to move a PTZ device to a specific preset using the
GotoPresetoperation.GotoHomePositionoperation.SetAuxiliaryCommandoperation.- Client shall be able to configure a media profile for audio streaming using the
GetCompatibleAudioSourceConfigurations,AddAudioSourceConfiguration,GetCompatibleAudioEncoderConfigurations, andAddAudioEncoderConfigurationoperations.StartMultiCastStreamingandStopMultiCastStreamingoperations.- Client shall be able to receive a multicast stream sent by a device.
GetRelayOutputsoperation.- Client shall be able to set the settings of a relay output using the
SetRelayOutputSettingsoperation.- Client shall be able to trigger a relay output using the
SetRelayOutputStateoperation.GetNTPandSetNTPoperations.GetDynamicDNSandSetDynamicDNSoperations.GetZeroConfigurationandSetZeroConfigurationoperations.GetIPAddressFilter,SetIPAddressFilter,AddIPAddressFilterandRemoveIPAddressFilteroperations.