kakone / VLC.MediaElement

MediaElement clone powered by VLC
GNU Lesser General Public License v2.1
68 stars 33 forks source link

Shoutcast Streaming #28

Closed RichieRogers closed 7 years ago

RichieRogers commented 7 years ago

Hi, trying to play from Shoutcast, but it's not working. For example: http://yp.shoutcast.com/sbin/tunein-station.pls?id=1364747 Plays fine in VLC However, for VLC media element, setting the source to http://yp.shoutcast.com/sbin/tunein-station.pls?id=1364747 results in the "sound of silence" :( So, is there a way of getting this to work?

Richie

RichieRogers commented 7 years ago

I've managed to get round it by passing the URL into the following function, which then returns the "real" url: public static async Task<List> GetStreamsFromPLSUrl(string url) { var httpClientHandler = new HttpClientHandler { UseDefaultCredentials = false, AllowAutoRedirect = true }; HttpClient httpClient = new HttpClient();

        try
        {
            HttpResponseMessage response = await httpClient.GetAsync(url);
            response.EnsureSuccessStatusCode();

            TextReader tr = new StreamReader(await response.Content.ReadAsStreamAsync());
            List<string> Streamurls = new List<string>();

            string line;
            while ((line = tr.ReadLine()) != null)
            {
                if (line.Substring(0, 4).Equals("File"))
                {
                    Streamurls.Add(line.Substring(6));
                }
            }
            return (Streamurls);
        }

        catch (Exception ex)
        {
            System.Diagnostics.Debug.WriteLine(ex.Message + "/n" + ex.InnerException);
            return null;
        }
    }
kakone commented 7 years ago

Plays fine in VLC

In VLC desktop or VLC for UWP ?

RichieRogers commented 7 years ago

Plays fine in VLC desktop - not tried VLC UWP app, not got it installed. The code i found above to get the real url from the pls file works fine for VLC media element

Richie

kakone commented 7 years ago

It would be nice to test it with VLC for UWP. If it doesn't work, you can create an new issue here : https://code.videolan.org/videolan/vlc-winrt/issues

RichieRogers commented 7 years ago

Hi, Finally tested on VLC for UWP and it doesn't work in that either. Thankfully my work around works