Archive

Posts Tagged ‘streaming’

Silverlight, WCF REST and Streaming My Personal Music Repository from a Standalone EXE

April 26th, 2010 Nathan 3 comments

This is way cool. From time to time, I tend to screw around with stuff I enjoy that really has little productive value.  A year ago this month, I recall wanting to continue writing about sharing your personal music without using IIS and hosting the music directly from a WCF standalone executable. Well it turns out this is a whole lot simpler than I originally thought.

Disclaimer: This probably isn’t best practice, and it’s ripe for enhancements. My hope is that it gets your imagination fired up and motivates you to continue where I left off.

Challenges:

  • How the heck do I stream an MP3 file to a media element via WCF (without having to download the whole file before playing it)?
  • Cross-site scripting policies are blocking my download requests. How can I serve these up via my self hosted WCF REST service?
  • Silverlight3 doesn’t support WCF REST yet. How do I deserialize the WCF REST contract messages?

 

Changes Since Last Release

player_small My original design was very simple.  I hosted the Silverlight files and used WCF with an IIS server at home. The player pulled a list of files and locations. The player’s media element source was set directly to a music file hosted in an IIS virtual directory. All that works great until you are on a machine without a web server. Ultimately, I wanted to figure out a way for the user to host their music repository from their desktop with a simple executable and port forwarding. Which means it would have to serve up all the resources necessary to run the Silverlight player. It would also have to serve up the WCF services and actual music files themselves.

Since the last post a year ago, I’ve made quite a few little tweaks to the player like: regular expression search, random songs, random play order, and a volume control. I also integrated a compact SQLite database for searching so the server-side doesn’t have to do a file system search for each request.

 

Read more…

Categories: Silverlight, WCF Tags: , , , ,

Silverlight, WCF, and Streaming My Personal Music Repository from IIS

April 8th, 2009 Nathan 2 comments

Updates

I’ve recently posted a new article continuing this topic:  Silverlight, WCF REST and Streaming My Personal Music Repository from a Standalone EXE , which as an updated client with regex search and random play functionality.

image

A buddy of mine recently had mentioned he wanted a web based program he could use to listen to his music from home.  As a contractor, we move around a lot. At some locations, we can’t install any software; others, we have firewall issues. Our mobile devices couldn’t hold every song we stored at home, and copying our music around everywhere just didn’t seem like a great idea.  So we thought… wouldn’t it be cool if we could have just a simple website that could stream our music from anywhere? It’s an easy install…

So I started digesting the idea and thought yeah, we could do that.  At first we’ll have to just use something simple like streaming the files directly from IIS in a silverlight music player of sorts.  But eventually, we can really take advantage of some cool WCF hosting features in windows and not require IIS at all, which would be great for most of us since everyone doesn’t have a windows server sitting around at home. After a tiny bit of research, I realize we could also take advantage of the Media Services component built into windows server and IIS, which from the sound of it are pretty comprehensive. But with our end goal in mind, we’ll want to find a way to stream it right out of a simple windows app available to any edition of Windows.

Having said all that, I decided to start writing about this little toy project.  To begin, we have a simple Silverlight application with a music player, list manager, and an IIS server hosting a virtual directly to our mp3 repository.

Read more…