1

I have the next HLS playlist: https://digitacdn.akamaized.net/hls/live/629243/radiosuomipop/master-128000.m3u8. It contains AAC audio file segments links. File content is:

#EXTM3U
#EXT-X-VERSION:3
## Created with Z/IPStream R/2 v1.03.23
#EXT-X-MEDIA-SEQUENCE:2984548
#EXT-X-TARGETDURATION:6
#EXT-X-PROGRAM-DATE-TIME:2018-10-23T11:44:44Z
#EXTINF:5.99, no desc
01493/seg128000-02984548.aac
#EXTINF:5.99, no desc
01493/seg128000-02984549.aac
#EXTINF:5.99, no desc
01493/seg128000-02984550.aac
#EXTINF:5.99, no desc
01493/seg128000-02984551.aac
#EXTINF:5.99, no desc
01493/seg128000-02984552.aac
#EXTINF:5.99, no desc
01493/seg128000-02984553.aac

I can not understand where these segments are located. Could anybody explain me that? How can I reach each separate segment to play it, for instance, with NAudio MediaFoundationReader?

Liidia
  • 55
  • 8
  • They exist **relative** to the source document, in exactly the same way as links in HTML pages work. So: for instance `01593/seg128000-03184874.aac` found in the document exists at `https://digitacdn.akamaized.net/hls/live/629243/radiosuomipop/01593/seg128000-03184874.aac` – spender Nov 06 '18 at 09:10
  • FYI, this is an HLS playlist. It doesn't have anything to do with SHOUTcast. – Brad Nov 09 '18 at 20:53
  • Ok, I will read about HLS playlists. Thank you, Brad! – Liidia Nov 10 '18 at 10:17

1 Answers1

2

Due to the lack of leading /, the resources exist at a location relative to the source document in exactly the same way as links in HTML pages work. So: for instance 01593/seg128000-03184874.aac found in the document at https://digitacdn.akamaized.net/hls/live/629243/radiosuomipop/master-128000.m3u8 exists at https://digitacdn.akamaized.net/hls/live/629243/radiosuomipop/01593/seg128000-03184874.aac.

A safe way of dealing with this is to use existing overloads on the Uri class:

var m3u8Url = 
  "https://digitacdn.akamaized.net/hls/live/629243/radiosuomipop/master-128000.m3u8"
var baseUri = new Uri(m3u8Url);
var resourceUri = new Uri(baseUri, "01493/seg128000-02984548.aac");
Console.WriteLine(resourceUri.AbsoluteUri);

Done this way, the resulting Urls will be assembled using the same logic as used by browsers, correctly dealing with relative (32724/foo), local absolute (/32724/foo) and fully qualified URLs (http://somehost/32724/foo).

spender
  • 117,338
  • 33
  • 229
  • 351