Get /vehicles/{vehicleId}/streams
Return a collection of consecutive images or a video from a specified vehicle at specified time.
Syntax
/vehicles/{vehicleId}/streams?time={date}&limit={integer}&offset={integer}&realtime={boolean}&format={string}&password={string}
URL Parameters
Name | Type | Description |
---|---|---|
vehicleId | string |
The unique identifier of a vehicle.
Note: Streams can only be returned when a Drive is currently online. |
Query Parameters
Name | Type | Description |
---|---|---|
time | date | A historical time in UTC. To retrieve a stream successfully, time must match the time returned in GET /drives. |
offset | integer |
Optional. The number of seconds to skip from the start of the stream to the first stream frame being returned.
Note: If the vehicle speed falls to 10kph or lower partway through a Drive, the Drive is truncated, and the maximum possible value for offset will reduce accordingly. |
limit | integer |
Optional. The number of stream frames to return up to a maximum of 10 for MJPEG streams, or 60 for MPEG-TS streams.
Note: If the vehicle speed falls below 10kph partway through a stream, the drive will be truncated and the stream will return fewer images than the limit. Note: Setting limit to less than the maximum value will not significantly reduce the time to retrieve a stream. |
interval | integer |
Optional. The number of seconds between stream frames up to a maximum of the length of the drive.
Note: To get the length of the returned stream in seconds multiply the limit by the interval. |
realtime | boolean |
Optional. If set to true, streams will be returned at the correct framerate.
If set to false, streams will be downloaded as fast as possible, and framerate information will be lost. Defaults to true.
Note: MPEG-TS streams do not currently support realtime=false. |
format | string |
Optional. Either “mjpeg” or “mpeg-ts”.
Note: Drive streams may not be available in all formats. |
password | string | Unique password supplied to you previously. |
Return Value
Type: multipart/x-mixed-replace
When the stream is in MJPEG format, each image is in JPEG format and will contain EXIF data as follows.
Name | Type | Description |
---|---|---|
DateTimeOriginal (Tag 0x9003) | date | The time that image was taken, in UTC. |
GPSLatitude (Tag 0x0002 under IFD 0x8825) | double | Longitude of the vehicle when the image was taken. |
GPSLongitude (Tag 0x0004 under IFD 0x8825) | double | Longitude of the vehicle when the image was taken. |
GPSSpeed (Tag 0x000d under IFD 0x8825) | integer | Speed of the vehicle when the image was taken, in kph. |
GPSImgDirection (Tag 0x0011 under IFD 0x8825) | integer | Heading of the vehicle when the image was taken, in degrees. Heading is expressed as a value greater or equal than 0 and less than 360 measured clockwise from north. i.e., 0 is north, 90 is east, 180 is south, 270 is west. |
Drive stream images are stored directly on the vehicle. This endpoint can fail if:
- the vehicle goes offline (immediate HTTP error 400, “Vehicle is not online” or delayed HTTP error 500, “Vehicle is offline”). To minimize offline vehicle errors, only request drive streams from drive data that was retrieved within the last 15 minutes. Retry once GET /drives reports the drive is online again.
- the vehicle loses a good cellular connection (delayed HTTP error 500, “Could not retrieve image stream”). Retry once GET /drives reports the drive is online again.
- the vehicle loses a good GPS connection (delayed HTTP error 500, "Bad or missing GPS data"). Retries will also fail.
- the vehicle recycles storage space to store newer drive streams (delayed HTTP error 500, "Image stream not found").
- the offset is greater than the length of the Drive (immediate HTTP error 400, “Offset exceeds the length of Drive").
- the vehicle is too busy with other requests (immediate HTTP error 503, “Vehicle is busy"). Retry after a few minutes.
The API will try to retrieve a drive stream from the vehicle for up to 5 minutes. Concurrent requests will not be released in the API until the full 5 minutes has passed, even if the Drive stream request timeout in your application is less than 5 minutes.
Any request which exceeds the concurrent request limit will produce an immediate HTTP 429 ("Too many requests") error. Note that an API request for a 10 second stream in MJPEG format counts as 10 concurrent requests. An API request for a 10 second stream in MPEG-TS format counts as 1 concurrent request.
Example
Request |
---|
https://www.vizzion.com/api/vehicles/12345/streams?time=2022-07-23T15:33:03Z&limit=10&offset=0&password=<password> |
Response |
---|
... --boundary Content-Type: image/jpeg Content-Length: 271437 |
Request |
---|
https://www.vizzion.com/api/vehicles/54321/streams?time=2022-09-21T09:12:34Z&limit=20&offset=0&format=mpeg-ts&password=<password> |
Response |
---|
|