Question : How Do I Post A .WAV File to a URL

Hi all

I am currently working with an IP camera which has an audio out. The camera accepts .wav files which are output through this audio out.
The camera's come with an activeX component which is used to send commands and get video data back from the camera. I have been able to send the camera audio using this activeX component successfully.

My problem is I need to send the audio commands via a windows service, I can't get the activeX component to work with the windows service so I am trying to post the audio data manually. The documentation try's to explain how this is done, but I haven't been able to get it to work yet.

The documentation says the following about posting audio to the camera:

Description

Remote host sends the audio data through HTTP session to the device to play out.

In two-way audio enabled device, it could accept the audio data from the remote host and play the audio data through its audio out interface. There is only one host could play the audio on the device at any time. The audio token in the device controls is used for this criterion.That means the host have to get the audio token first.

If audio token is not available, the error message, 503 Service Unavailable, will be returned.

Currently, the device just only accepts the PCM with 8KHz sample rate, 16bits/sample format.

In the multiple channel video server, the HTTP port of this command should be the HTTP port of the channel not the router.

The POST method is used in this URL command to send to the device. If there is no error code was replied from the device, the host could upload its audio data to the device. The multipart/x-mixed-replace in the content type is used during the upload. The length of every multipart boundary is 1024 bytes. Here is the network trace from host to the device as an example.

POST /cgi-bin/cmd/encoder?SEND_AUDIO HTTP/1.1
Content-Type: multipart/x-mixed-replace;boundary=----------AoutBoundary
Connection: Keep-Alive
Cache-Control: no-cache
Authorization: Basic YWRtaW46MTIzNDU2

----------AoutBoundary
Content-Type: audio/pcm
Content-Length: 1024

....Audio raw data....

----------AoutBoundary
Content-Type: audio/pcm
Content-Length: 1024

....Audio raw data....

....

Input Augument

None

Attribute

None

Return of Message

None if everything is OK,
401 Unauthorized if fails of authentication,
503 Service Unavailable if it is not two-way audio device or audio token is not available,
404 Not Found if there is something wrong in the POST header.
Applicability

WPL Platfrom: 1CH encoder
EPL Platfrom: All Encoders
PlatfromT: All Encoders
Multi-Channel Encoder: All Video Servers
Status

Valid

See Also

None

Example

http://ip:port/cgi-bin/encoder?USER=admin&PWD=123456&SEND_AUDIO      
or
http://ip:port/cgi-bin/cmd/encoder?SEND_AUDIO


After reading this I had the following sequence of events in my head:

1. Send first command and get response.
2. If response is ok get the audio raw data (byte[])
3. Split this raw data into segments of 1024 and post them to the device.

I am not sure where the audio token is returned to me either? And where do I place this audio token when I am posting the data?

Sorry if this question is vague, that documentation is all I have to work with. Any help appreciated.

Regards

Answer : How Do I Post A .WAV File to a URL

I have found my problem, the camera I am working with does not support the commands I am trying to send to it. Will close this.
Random Solutions  
 
programming4us programming4us