PeerTube
PeerTube copied to clipboard
add m3u8 links in API (streamingPlaylists[].files[].playlistUrl)
Describe the problem to be solved
in /api/v1/videos/{id}
, for HLS videos, we have a list of URLs in streamingPlaylists[].files[].fileUrl
, ending with -fragmented.mp4
.
The same content is also accessible by replacing -fragmented.mp4 with .m3u8, but both are not the same: For clients using libav* libraries from the ffmpeg project, the two URLs give vastly different results in terms of stream start speed:
#Wait almost a minute
ffplay https://www.yiny.org/static/streaming-playlists/hls/48134610-d310-442e-84df-f124fb7f0789/cdc70c1d-f5a1-4e9e-8691-f2c899d561be-480-fragmented.mp4
vs
#Instant start
https://www.yiny.org/static/streaming-playlists/hls/48134610-d310-442e-84df-f124fb7f0789/cdc70c1d-f5a1-4e9e-8691-f2c899d561be-480.m3u8
It would be nice (and clean for API users) to have the .m3u8 URL advertised in the API json. For now I replace -fragmented.mp4
with .m3u8
, but this is not clean.
There is also already a streamingPlaylists[].playlistUrl
sent in the API, ending with -master.m3u8
, but using this one is more complicated for clients, requiring them to implement an m3u8 parser to understand the various options they have.
Describe the solution you would like
I would love to have a streamingPlaylists[].files[].playlistUrl
field in the /api/v1/videos/{id}
JSON response.