From 6da35c8041ecba1ed9fe49a7c320ab48d36beaa4 Mon Sep 17 00:00:00 2001 From: Alessandro Ros Date: Sun, 25 Aug 2024 23:04:36 +0200 Subject: [PATCH] playback: add "url" field to recording timespans in /list (#3619) --- README.md | 12 +++++---- internal/playback/on_get.go | 24 +++++++++--------- internal/playback/on_list.go | 42 ++++++++++++++++++++++++------- internal/playback/on_list_test.go | 8 ++++++ 4 files changed, 60 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index bc3d6f6b..793e1ec7 100644 --- a/README.md +++ b/README.md @@ -1186,7 +1186,7 @@ The JWT is expected to contain the `mediamtx_permissions` scope, with a list of } ``` -Clients are expected to pass the JWT in the Authorization header (in case of HLS and WebRTC) or in query parameters (in case of any other protocol), for instance (RTSP): +Clients are expected to pass the JWT in the Authorization header (in case of HLS and WebRTC) or in query parameters (in case of all other protocols), for instance: ``` ffmpeg -re -stream_loop -1 -i file.ts -c copy -f rtsp rtsp://localhost:8554/mystream?jwt=MY_JWT @@ -1350,16 +1350,18 @@ Where [mypath] is the name of a path. The server will return a list of timespans [ { "start": "2006-01-02T15:04:05Z07:00", - "duration": "60.0" + "duration": "60.0", + "url": "http://localhost:9996/get?path=[mypath]&start=2006-01-02T15%3A04%3A05Z07%3A00&duration=60.0" }, { "start": "2006-01-02T15:07:05Z07:00", - "duration": "32.33" + "duration": "32.33", + "url": "http://localhost:9996/get?path=[mypath]&start=2006-01-02T15%3A07%3A05Z07%3A00&duration=32.33" } ] ``` -The server provides an endpoint for downloading recordings: +The server provides an endpoint to download recordings: ``` http://localhost:9996/get?path=[mypath]&start=[start_date]&duration=[duration]&format=[format] @@ -1375,7 +1377,7 @@ Where: All parameters must be [url-encoded](https://www.urlencoder.org/). For instance: ``` -http://localhost:9996/get?path=stream2&start=2024-01-14T16%3A33%3A17%2B00%3A00&duration=200.5 +http://localhost:9996/get?path=mypath&start=2024-01-14T16%3A33%3A17%2B00%3A00&duration=200.5 ``` The resulting stream uses the fMP4 format, that is natively compatible with any browser, therefore its URL can be directly inserted into a \