Audio push via HTTP
Introduction
The following guide outlines the process of sending the audio to the speaker associated with an Eagle Eye Networks camera. This is particularly useful for sending the raw audio (ulaw/alaw) via HTTP.
Important
Only one person at a time can communicate with a speaker. Audio push is a talk-down feature and it is not meant to be used for two-way-audio purposes, as there would be about 5 seconds delay in sending audio with push audio HTTP.
See the 2-Way Audio (No SDK), for a synced audio communication based on the WebRTC protocol.
Note
Currently, the supported audio types are alaw and ulaw.
Prerequisites
Make sure you meet the following requirements:
- You have a valid Eagle Eye Networks account.
- The camera and the speaker is associated with the account.
- The speaker is connected to the camera.
Procedure
Follow these steps to send the audio to the speaker associated with Eagle Eye Networks camera.
- Log in to your Eagle Eye Networks account.
Note
You can get your Base URL and access token from your account. See Logging in.
- Call the /feeds API with the camera ID using the following cURL command.
Note
Make sure to replace
<access_token>
with your valid access token and thedeviceId
in parameters with the camera ID you want to access.
curl --request GET \
--url 'https://<<BaseUrl>>/api/v3.0/feeds?deviceId=<<deviceId>>&include=audioPushHttpsUrl' \
--header 'accept: application/json' \
--header 'authorization: Bearer <<access_token>>'
The response contains the audioPushHttpsUrl
for the specified camera if a speaker is associated with this camera.
The following is a sample response for the above call:
{
"nextPageToken": "",
"prevPageToken": "",
"results": [
{
"id": "10001523-main",
"type": "main",
"deviceId": "1000dabb",
"mediaType": "audio"
"audioPushHttpsUrl": "https://media.c123.eagleeyenetworks.com/media/streams/audio/1000dabb/"
}
- Send the audio to the speaker by doing the following:
i. Extract theaudioPushHttpsUrl
from the JSON response.
ii. Get the captured raw audio type.
iii. Create the audioPush endpoint by appending the audio type to theaudioPushHttpsUrl
.
-
For ulaw:
<https://media.c123.eagleeyenetworks.com/media/streams/audio/1000dabb/ulaw>
-
For alaw:
<https://media.c123.eagleeyenetworks.com/media/streams/audio/1000dabb/alaw>
iv. Send the audio to the audioPush endpoint.
Note
Make sure to replace
<access_token>
with your valid access token and thedeviceId
in parameters with the camera ID you want to access.
curl --form 'audio_chunk=@./sample_8k_8bit_1ch_ulaw.raw'
--header 'Authorization: bearer <access_token>'
--location https://media.c123.eagleeyenetworks.com/media/streams/audio/10000dabb/ulaw --header 'Transfer-Encoding: chunked' --limit-rate 8000b
Result: You are now able to send the audio to the speaker.
Updated about 1 year ago