This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

LM object data as metadata on videocamera's stream
#4
Try this, change camera URL and text message as needed. Uncomment last line with logging if request does not work.
Code:
12345678910111213141516171819202122232425262728293031323334353637383940414243444546
url = 'http://USER:PASS@IP/Video/inputs/channels/1/overlays/text/1' text = 'Test message' function http_put_xml(url, xml)   local http = require('socket.http')   local ltn12 = require('ltn12')   local resp = {}   local res, code = http.request({     url = url,     method = 'PUT',     headers = {       ['content-type'] = 'text/xml',       ['content-length'] = #xml,     },     source = ltn12.source.string(xml),     sink = ltn12.sink.table(resp),   })   if res then     return table.concat(resp), code   else     return nil, code   end end function xml_escape(text)   return text     :gsub('&', '&amp;')     :gsub('<', '&lt;')     :gsub('>', '&gt;')     :gsub('"', '&quot;')     :gsub("'", '&apos;') end xml = [[<?xml version="1.0" encoding="UTF-8"?> <TextOverlay xmlns="http://www.hikvision.com/ver10/XMLSchema" version="1.0"> <id>1</id> <enabled>true</enabled> <posX>16</posX> <posY>16</posY> <message>]] .. xml_escape(text) .. [[</message> </TextOverlay>]] res, err = http_put_xml(url, xml) -- log(res, err)
Reply


Messages In This Thread
RE: LM object data as metadata on videocamera's stream - by admin - 27.12.2018, 13:46

Forum Jump: