Netflix browser: OData, Prism, MVVM and Silverlight 4

by Alex on April 28, 2010

During one of the keynotes at MIX 2010, Doug Purdy discussed OData and explained that Netflix, working in conjunction with Microsoft, had created and launched an OData feed. Armed with that information and being a big Netflix fan, I decided to whip up a small demo application taking advantage of this new feed while showcasing some of the cool stuff that is baked into Prism as well. If you don’t know Prism, check out this previous post where I provide some resources for getting up to speed with it.  I’m considering doing a few screen casts that walk through how I created the Netflix browser if there is an appetite for it, so let me know.

Here is a screen shot of the final app or you can run the real thing here

screen

The grey boxes aren’t in the actual app. They’re here to represent the different modules. There are 3 distinct UI modules.

  1. The browse criteria bar at the top.
  2. The list of browse results
  3. The movie detail

Each of these areas is a distinct region that doesn’t know anything about the others. I used the Event Aggregation service that is part of Prism to publish events out to the app. Any module interested in that event just subscribes to the event.

Project layout

I tried to keep the project layout as simple as possible. Here’s a look at the solution explorer panel from VS2010.  As you can see, I’ve separated the client and server code into two distinct folders.

A couple of points to make note of here

  1. All the projects in the client folder are Silverlight applications except for Netflix.Common.  Netflix.Common is a Silverlight library that all other projects reference.
  2. All project names ending in “UI” represent a view that will be displayed on the screen. They all include the same folder structure that you see under Netflix.QueryUI. (Modules, Views and ViewModels)
  3. Netflix.Dialog and Netflix.Data are services that the application uses.
    All queries to Netflix take place in Netflix.Data.
    Netflix.Dialog is a simple dialog service.  Hat tip to Jeremy Likness for this idea.
    Both of these services register with Unity on startup and are injected when needed via constructor injection.
solExp

If you’re like me the best way to understand anything is to take it apart, so have at it.

You can download the full source code here.

As always, I’m happy to answer any questions.

Thanks for visiting and enjoy.

{ 1 trackback }

Tweets that mention Netflix browser: #OData, #Prism, #MVVM and #Silverlight 4 -- Topsy.com
April 28, 2010 at 9:39 am

{ 2 comments… read them below or add one }

Kristopher Roy May 24, 2010 at 10:18 am

Good Morning,
This looks very interesting and I wonder if a person could use it to increase netflix quality and stability? What I mean by that is two fold, the netflix streamer checks your bandwidth as you know, and that modifies your stream to a quality level for that. But a person could overcome the streaming issue with a larger buffer cache size. Unfortunately Netflix only sets your silverlight application storage to 1MB, I am not programmer, but do you think it would be possible to force the quality you want, and increase the silverlight buffer size?

Alex May 24, 2010 at 10:27 am

Kristopher,
In regard to the app that I built, It simply allows a user to browse the Netflix catalog via their OData feed. It does not allow for watching video. That being said, a Silverlight app most certainly could ask the user for permission to use more than one MB of Isolated Storage but not having looked at the Netflix streamer or related docs, I cant say if that would allow you to improve the quality/stability.

Leave a Comment

Previous post:

Next post:

Get Adobe Flash playerPlugin by wpburn.com wordpress themes