WS '/api/http_audio' API endpoint
Answeredhi,
i need some help with WS audio endpoint. when i try to establish WS connection server returns HTTP 404.
i have tried both secure and non-secure connections.
how to use this endpoint?
what are prerequisites?
-
Hello Denis Rozhkov ,
how to use this endpoint?
what are prerequisites?Here is a quotation from the built-in API documentation.
Please pay your attention, it should be a websocket connection, not plain HTTP/HTTS connection.
I'd need more details for more specific assistance. What is your scenario? What is the final result, you'd like to achieve?
Could you please share a code example of how you are trying to connect?
Just place files (or an archive) on the Google drive or similar and post a link to it here. -
hi Andrey,
i need to stream audio back from nx meta (mic) to the camera
https://1drv.ms/u/s!Aox6-d_KSzT7g4cOxDm9OHB9_mLhLQ?e=Yzap2z
-
hi Andrey,
thank you! -
Hello Denis,
Here is what I've found, so far.
In the wavewsclient.cpp the code
m_wsConnection = m_wsClient.get_connection(m_wsUri, ec);
leads to an error having this string in the ec.message()
endpoint not secure
In fact, the get_connection() method does not pass this check (see the client_endpoint.hpp file)
connection_ptr get_connection(uri_ptr location, lib::error_code & ec) {
if (location->get_secure() && !transport_type::is_secure()) {
ec = error::make_error_code(error::endpoint_not_secure);
return connection_ptr();
}
...I guess, transport_type has to be set to the secure type in the config of the m_wsClient, since wss (secured websocket) is supposed to be used.
-
hi Andrey,
thanks, so actually it's a WSS endpoint (not WS as stated in the documentation)?
ok, i'll check it... -
Andrey,
still doesn't work, and still HTTP 404:GET https://as-gm04:7001/api/http_audio?camera_id=a118a339-82ac-b8fa-d4bf-c2d7529534a2&format=s16be&sample_rate=22050&channels=1&auth=YWRtaW46NWNkNGZjYmUxNDFhODozMGY0NDk5YzM1ZTk2NjJlZWRiZDI2ZDM0YTQ4MTA5Zg== HTTP/1.1
Host: as-gm04:7001
Connection: Upgrade
Upgrade: websocket
Sec-WebSocket-Version: 13
Sec-WebSocket-Key: M0lIo8NAvUCJO6affEauSg==HTTP/1.1 404 Not Found
Date: Fri, 01 Oct 2021 22:50:37 +0300
Server: Nx Meta/4.2.0.32836 (Network Optix) Apache/2.4.16 (MSWin)
Connection: Keep-Alive
Keep-Alive: timeout=5
Content-Length: 0
Access-Control-Allow-Origin: * -
Denis,
thanks, so actually it's a WSS endpoint (not WS as stated in the documentation)?
Yes, starting with a certain build, HTTP has been disabled for all the communication types with the Server. All request are redirected to the HTTPS. Web API functions should be invoked using HTTPS.
One more thing. We've recently rolled out a new early preview version (Meta 5.0 R3), which has a completely new REST API -- you can try it out. Although not all the API functions has been transferred there, it should be much more convenient to use: https://meta.nxvms.com/downloads/patches
-
hi Andrey,
the code is updated -
Hello Denis,
how to use this endpoint?
You just send an audio file of the PCM stream to the opened websocket.
what are prerequisites?
The device (a camera or an I/O module) has to support 2-way audio. The "Enable Audio" flag has to be set in the GUI.
(is there any method to do this other than implementing ONVIF services?)
If a camera does not support ONVIF, you can develop your own camera driver (a plugin) with Video source SDK.
-
hi Andrey,
You just send an audio file of the PCM stream to the opened websocket.
and audio will be sent via RTSP backchannel to the camera?
if i understand all right - Wisenet's support doesn't understand how system works. They were asked how it's possible to send audio from the (WAVE VMS) client app to the camera (except RTSP backchannel) and they suggested to use:
1. Video Source SDK
2. WS endpointand both options are not suitable for the task...
-
Denis,
They were asked how it's possible to send audio from the (WAVE VMS) client app
That's something more about your scenario. And that's something different from what we are discussing here.
Tell me more about the scenario, user case, business case, please.
For instance. Are you developing your own external web service (or GUI application) because business needs call operators to... ? Do you need this application/service be accessible via VMS GUI application? etc.
You see, I don't stop asking you about that just because we have code examples and those could suite you right away without the long discussion and debugging code specifics.
-
Denis,
and audio will be sent via RTSP backchannel to the camera?
Audio _from_ the camera is not a problem, the problem is how to send audio stream form WAVE VMS client _to_ the camera (without RTSP backchannel)...
I'm sorry. I did not understand you.
The answer is NO. When send audio to a camera (in fact to the Server) via a websokcket there is only a websocket. No RTSP.
1. You send audio to the Server via a websocket.
2. The Server sends audio to a camera.
-
Tell me more about the scenario, user case, business case, please.
hmm...i need to stream audio back from nx meta (mic) to the camera
so basically i need to press mic icon in the WAVE VMS client, say something and receive this mic input on the camera side. that's all. and again - without RTSP backchannel.
and we were informed by Hanwha/Wisenet that this can be achieved with Video Source SDK or WS API. but it's just not true.
-
Denis,
so basically i need to press mic icon in the WAVE VMS client, say something and receive this mic input on the camera side. that's all. and again - without RTSP backchannel.
Could you please share with us where, why and what for did the requirement "without RTSP backchannel" come from? What are the specifics of your case?
-
Where, why and what for did this requirement "without RTSP backchannel" come from?
that doesn't matter. in general we wanted to implement some lightweight transport, we can do this (with Video Source SDK) for input streams, so we were interesting if it's possible for audio output. and as it's revealed now we were misinformed that it's possible.
anyway, thanks for clarification.
Please sign in to leave a comment.
Comments
29 comments