Play audio from channel on WPF


I’m developing a sort of radio application with WPF and C# and I want to be able to reproduce only the audio from a channel, but I can’t find any library that allows me to do that.

Is there a way to do it?

This isn’t supported and I don’t think you’re supposed to, but here’s the steps:

Step 1: Get a token and a signature:

curl '{{channel name}}/access_token' \
-H "Client-ID: {{your client id}}"

This returns JSON like this:

    "token": "long, JSON-escaped string of JSON",
    "sig": "8d5f2df9ad2761f136eea27902a2fe34e12f6796",
    "mobile_restricted": false

Step 2: Get the playlist (m3u8)

You need the “sig” and “token” for the next request. Use that data like this: (client ID optional)

curl '{{channel name}}.m3u8? \
allow_audio_only=true&sig=8d5f2df9ad2761f136eea27902a2fe34e12f6796 \

Critical bit there is “allow_audio_only=true” (otherwise it’s not included). This gives you an M3U8 manifest that you need to parse. You’ll see a group called “audio_only” in the list:


The “.m3u8” file at “index-live.m3u8” is a list of “.ts” files in the same /directory. These are the containers for the stream data itself. You can keep checking “index-live.m3u8” as it will continue to update. I don’t know what you’re going to use to play the audio, but it might accept the “index-live.m3u8” file rather than buffering the source yourself.

For instance, VLC or FFPlay will happily play this audio:

vlc ""
ffplay ""