Skip to content
This repository has been archived by the owner on Aug 25, 2020. It is now read-only.
/ UWPShoutcastMSS Public archive

A library for connecting to Shoutcast in Windows 10 UWP applications.

License

Notifications You must be signed in to change notification settings

Amrykid/UWPShoutcastMSS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UWPShoutcastMSS

A library for connecting to Shoutcast in Windows 10 UWP applications.

How to use it

Easy, peasy.

Foreground Audio

Assuming you set up an invisible MediaPlayer named 'MediaPlayer', the following should work:

ShoutcastStream shoutcastStream = await ShoutcastStreamFactory.ConnectAsync( new Uri("http://194.232.200.156:8000/"));
MediaPlayer.SetMediaStreamSource(shoutcastStream.MediaStreamSource);
MediaPlayer.Play();

Background Audio

Use the following in your audio background task.

//Initialize the stream and connect
ShoutcastStream shoutcastStream = await ShoutcastStreamFactory.ConnectAsync( new Uri("http://194.232.200.156:8000/"));
//Hook up an event handler for grabbing metadata when it changes. This means you can update your "Now Playing" display.
streamManager.MetadataChanged += Metadata_EventHandler;
//Old-style background audio works like this
//Set the manager's underlying stream as the BackgroundMediaPlayer's MediaSource.
BackgroundMediaPlayer.Current.SetMediaSource(streamManager.MediaStreamSource);
//Play!
BackgroundMediaPlayer.Current.Play();

Single-process Background Audio

//New-style background audio works like this
//Make sure to have the background audio permission set in your application's manifest.
MediaPlayer.SetMediaStreamSource(shoutcastStream.MediaStreamSource);
MediaPlayer.Play();

Want to contribute?

I'm pretty new to the open source scene so if you have any contributions, feel free to send a pull request. I will be re-evaluating the license of the code in the future if it is a problem. I will also be looking into setting up a Nuget package if this library takes off.

Known Issues