mirror of
https://github.com/bluenviron/mediamtx
synced 2024-12-13 10:14:58 +00:00
playback: make 'format' parameter optional (#2980)
This commit is contained in:
parent
de9a456e98
commit
695e327a03
@ -1224,7 +1224,7 @@ Where [mypath] is the name of a path. The server will return a list of timespans
|
||||
The server provides an endpoint for downloading recordings:
|
||||
|
||||
```
|
||||
http://localhost:9996/get?path=[mypath]&start=[start_date]&duration=[duration]&format=[format]
|
||||
http://localhost:9996/get?path=[mypath]&start=[start_date]&duration=[duration]
|
||||
```
|
||||
|
||||
Where:
|
||||
@ -1232,19 +1232,18 @@ Where:
|
||||
* [mypath] is the path name
|
||||
* [start_date] is the start date in RFC3339 format
|
||||
* [duration] is the maximum duration of the recording in seconds
|
||||
* [format] must be fmp4
|
||||
|
||||
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&format=fmp4
|
||||
http://localhost:9996/get?path=stream2&start=2024-01-14T16%3A33%3A17%2B00%3A00&duration=200.5
|
||||
```
|
||||
|
||||
The resulting stream is natively compatible with any browser, therefore its URL can be directly inserted into a \<video> tag:
|
||||
The resulting stream uses the fMP4 format, that is natively compatible with any browser, therefore its URL can be directly inserted into a \<video> tag:
|
||||
|
||||
```html
|
||||
<video controls>
|
||||
<source src="http://localhost:9996/get?path=[mypath]&start=[start_date]&duration=[duration]&format=[format]" type="video/mp4" />
|
||||
<source src="http://localhost:9996/get?path=[mypath]&start=[start_date]&duration=[duration]" type="video/mp4" />
|
||||
</video>
|
||||
```
|
||||
|
||||
|
@ -190,7 +190,7 @@ func (p *Server) onGet(ctx *gin.Context) {
|
||||
}
|
||||
|
||||
format := ctx.Query("format")
|
||||
if format != "fmp4" {
|
||||
if format != "" && format != "fmp4" {
|
||||
p.writeError(ctx, http.StatusBadRequest, fmt.Errorf("invalid format: %s", format))
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user