Giter Site home page Giter Site logo

amrykid / uwpshoutcastmss Goto Github PK

View Code? Open in Web Editor NEW
14.0 3.0 3.0 277 KB

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

License: MIT License

C# 100.00%
shoutcast uwp windows windows-10 library windows-phone icecast media-player streaming winrt

uwpshoutcastmss's Introduction

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

uwpshoutcastmss's People

Contributors

azurekitsune avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

uwpshoutcastmss's Issues

Support Ogg Vorbis/Opus (for IceCast 2)

Newer IceCast servers support ogg streams where the metadata is embedded in the audio directly. While that is a possible in it self, there is no way to create a Vorbis/Opus decoder for playback. More specifically, there is no way to create AudioEncodingProperties for it.

I posted a feedback item for it on the UserVoice site. It can be found here.

[TODO] Support AAC Streams

[TODO] Parse Audio Data

The library needs to be able to parse audio frame data to determine channel count, bitrate, etc.

Some stations cause Unicode errors when parsing headers

A station named Conect Rádio 64k AAC
(http://142.4.222.227:9890/) is causing an exception when connecting due to a Unicode issue.

Exception:
Message: No mapping for the Unicode character exists in the target multi-byte code page.
Stack Trace: None but it comes from this line in ShoutcastMediaSourceManager

while (!response.EndsWith(Environment.NewLine + Environment.NewLine))
{
    await socketReader.LoadAsync(1);
    response += socketReader.ReadString(1);
}

Its possible that #5 will fix this.

[TODO] Use HttpClient for negotiating connections

The library should use an actual HTTP library instead of my hack to get the connection going. This will also handle certain streams that send down weird Unicode characters that currently kill the library (see #7).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.