How to play a radio channel in a C # UWP application?

I have a UWP (Universal Windows Platform) application and I want to add a shoutcast player, but cannot find anything to do it.

I have a button that should start / stop playing music and a volume slider. I found an element in xaml like MediaElement, but when I try to use it like this:

private async void StartPlayer()
        {
            var result = await AdaptiveMediaSource.CreateFromUriAsync(new Uri("http://camon22.sxcore.net:"+Port, UriKind.Absolute));
            if (result.Status == AdaptiveMediaSourceCreationStatus.Success)
            {
                var astream = result.MediaSource;
                Media.SetMediaStreamSource(astream);
            }
            else
            {
                var dialog = new MessageDialog("Result Status Wrong!\n"+result.Status);
                await dialog.ShowAsync();
            }
        }

I got the status UnsupportedManifestContestType.

Does anyone know how to play the radio in the UWP app?

+4
source share

Source: https://habr.com/ru/post/1626615/


All Articles