Closed RotemDoar closed 1 month ago
@RotemDoar please fix the lint problems by running eslint --fix lib/*.js
Thank you!
@agsh I fixed the lint issues.
running -
npx eslint --fix lib/*.js
now returns no errors.
@RotemDoar thanks! Done! https://github.com/agsh/onvif/releases/tag/v0.7.3
Adding ability to set OSD of type DateAndTime.
The function setOSD from lib/media.js previously only supported the addition of Plain Text, as indicated in the comment at line 1286: "ONVIF can handle custom positions, date/time, text, font sizes, transparency, images, etc. We only support Plain Text."
As part of my work, I encountered the need to configure the OSD of date and time for certain cameras. Upon reviewing the Onvif MediaBinding specifications available at https://www.onvif.org/ver10/media/wsdl/media.wsdl and https://www.onvif.org/ver20/media/wsdl/media.wsdl (both media and media2 versions), I found that in the setOSD function, it is possible to set the Type as DateAndTime for configuring date and time display.
Furthermore, I examined the output of the getOSDs function for my cameras and observed that for the OSD date-time, the property "textString" was of type 'DateAndTime'. For instance, here is the result of getOSDs for one of my cameras:
[ { '$': { token: 'OSD_DATE_TIME' }, videoSourceConfigurationToken: 'VideoSource_token_1', type: 'Text', position: { type: 'Custom', pos: { y: 0.980000019, x: 0.319999993 } }, textString: { type: 'DateAndTime', dateFormat: 'yyyy/MM/dd', timeFormat: 'HH:mm:ss', fontSize: 16, fontColor: [Object], extension: [Object] } },
For adding the ability to change OSD date and time, I firstly I changed the part of TextString in the method setOSD line 1311 as follows -
To -
Added hard-coded the date and time format. I checked it with my cameras and it works properly, I succeeded to set date and time OSD.
For supported both Plain and DateAndTime, I added an input to the function - dateFormat and timeFormat as I described here -
and changed the TextString part to be -