24 January, 2024

Howen device video data via API

How to obtain video data from any Howen device via API.

Howen provides a range of all-in-one AI dashcams with good positioning, accurate DMS/ADAS, and rich interfaces. Here's how you can obtain video telematics data from Howen devices in 6 easy steps:

  1. Create a free account on flespi.io

  2. Set up the Howen channel in the dashboard

  3. Point a Howen device to your flespi account

  4. Create a device in flespi

  5. Manage your media in the dashboard

  6. Access your media via API

1. Create a free account on flespi.io

First open flespi.io and create a free account or login with your credentials (you can proceed with your Google account for a quick sign-in).

2. Set up a Howen channel

In the dashboard, you need to create a channel first. Follow to the Telematics Hub > Channels > "+" button. Name your channel and select ‘howen’ as the ‘Protocol id’, then click on 'SAVE + OPEN'.

3. Point your device to Howen channel

Make a note of the host and port of your flespi channel that you're going to point your device to. Important: the image below indicates where to find the info and is NOT an actual domain/port for you to use (in flespi each channel created by you has its own IP and port).

Howen provides a dedicated mobile app available both for iOS and Android. It will help with basic device setup, also you will need to configure the device network connection and codec.

Now open the app and follow to Network > Center. Select Central Server 1, and fill in ‘Server1 Addr’ and ‘Port’ fields with flespi ‘Host’ and ‘Port’ values correspondingly. Don’t forget to change Protocol to ‘H-Protocol’ to allow the connection to a specific server, otherwise, select ‘Close’ to restrict.

Open the Logs & Messages tab for your channel to see if messages are coming in. Also you can check the app whether the device is connected to the flespi server.

Note: if you occasionally provided 2 Central servers with identical host and port values you’d see something unusual in the Logs & Messages pane as the device connects, immediately tries to connect again, and then closes the previous connection.

4. Create a device in flespi

Flespi is a device-centric platform. It means that most of the platform functionality is available on the device level. To add a new device you need to open the flespi panel and follow through Telematics Hub > Devices, then click on the '+' button. 

Choose the device model, and use the serial number or the 'ident' value (look up in the channel's Logs & Messages) to fill in the ‘Serial Number as ident’ field. As we’re setting up a video device you’ll see the Cameras section: 

Depending on the device specifications you can set up other cameras to have all of them available - one camera per ‘Camera channel’. Click ‘SAVE + OPEN’ when you’re ready.

5. Manage your media in the dashboard

To take a snapshot, capture a video, or start a live stream you can use the Mediabox UI tool with its intuitive control interface or run specific commands on the Commands & Settings tab. Also, in Mediabox you can easily access and manage all the files stored (preview snapshots, playback recorded video, protect files from automatic deletion, share them, etc.).

5.1. How to request a video

To request a video you need to click on a red camera icon on the Media tab and the following dialog box will show up:

Select the Camera channel, and specify Time from, Duration, and Video frames. When the command is sent to the device successfully you’ll see a recorded file appear on the list and the Last events pane. 

Also, you can use the standard command named 'request_video' on the Commands & Settings tab. This command may contain manufacturer-specific options, providing fine-tuning capabilities when necessary, but always includes three required options: 

  • camera channel index ("channel" property),
  • video recording time ("from" property),
  • clip duration ("duration" property).

The request will look like the following:

curl -X POST --header 'Authorization: FlespiToken XXXX' -d '[{"name":"request_video","properties":{"channel":1,"duration":10,"from":1706006460},"ttl":86400}]' 'https://flespi.io/gw/devices/YYYY/commands-queue'
  • With this call, you instruct flespi to download video from device YYYY recorded at 1706006460 (in GMT this is January 23, 2024, 10:41:00) and duration of 10 seconds.
  • This command will stay in the command queue for up to 1 day (86400 seconds) waiting for the device to be connected and be able to serve this command.
  • Once the command is executed you get full information about the video clip with UUID and a direct link.

You can find more info about commands and how to use them in flespi here.

5.2. How to start a live stream

On the Media tab click on the green camera icon. The following dialog box lets you choose the camera channel, and stream type. This parameter is tied with protocol specifications, while Howen provides 'Main stream’ for maximum quality and a ‘Substream’ for a mobile-quality one.

As the video stream becomes available, you’ll notice a preview window on the Last events pane. As the stream is not recorded, you won’t see a corresponding file added to the bottom of the file list. 

You can also instruct the device to start streaming with the ‘start_videostream’ command on the Commands & Settings tab where the most important option is to select the channel number. The request will look as follows: 

curl -X POST --header 'Authorization: FlespiToken XXXX -d '[{"name":"start_videostream","properties":{"channel":1,"mediastream":"hls","streamtype":"main"},"timeout":10}]' 'https://flespi.io/gw/devices/YYYY/commands'

As the command is executed, you'll see the response with a .m3u8 link to load it into a media player::

Important: The live stream will be automatically stopped after 60 seconds if there's no active browser session or other HLS-compatible client connected. To control your traffic you can stop a stream in these ways:

  • click on a particular display-crossed icon on the Media tab, 
  • make a request, where YYYY is your 'device_id', and ZZZZ - 'connection_id', that can be found in the initial 'start_videostream' message: 
curl -X DELETE  --header 'Authorization: FlespiToken XXXX''https://flespi.io/gw/devices/YYYY/connections/ZZZZ'

6. Access your media via API

In the main menu follow Telematics Hub > Devices > 'Your Howen Device' > Info > DocsThe following operations are available for each media device:

  • Delete all or specific files.
  • Search for some files or list all files.
  • Add your own set of properties to a file, or protect/unprotect it from being deleted automatically.

For example, you need to get the list of all media files stored in the device with their URLs and UUIDs. 

Use GET /devices/{dev-selector}/media request. Fill in 'dev-selector' with your 'device_id', add 'name,uuid,url' to the 'data' field, and perform the request by clicking on the 'eye' icon.

The response will look as follows:

Hint: as all files have a unique UUID property, which is used to identify the file, there's no need to use tokens for authorization — you just use it as is. 

That's it. :) Got questions? We're just one click away to assist you in the chat.


What's next?