Building a Web Site with ASP .NET 2.0 to Navigate Your Music Library

Sign in to queue

The Discussion

  • User profile image
    Mobileapples

    This is useful code. I will and test and see if it works with  all the formats.

  • User profile image
    Clarence

    What is the user wants to stop the currentMedia? I have tried to use a 'Stop' button

    Sub button_OnClick()

    wmpPlayer.controls.stop

    End Sub

    But on Page.PostBack I cannot access the Media Player that I was controlling from the previous page. All I can access is the new instance of the media player created after my postback oocurred.

    I am not handling anything via client side.

  • User profile image
    Clarence

    Got it, Save it to a session variable

    Session.Add("mediaPlayer", wmpPlayer)

  • User profile image
    Duy

    Can I hlep you change skin using window media sdk  ( language C# or VB)

  • User profile image
    Clint

    @Emmanuel:  Use a BLOB datatype.

  • User profile image
    Mani

    How do I access the "Add to Library" functionality from C# or c++?

    Help will be highly appreciated.

  • User profile image
    Lee

    I can only make this work using Cassini.  If i use IIS, it doesn't detect any of my music files.  What am i missing?

  • User profile image
    varadharaj

    i need to develop an web application in such a way that the audio files will be stored in a server and i need to play those audio files from an asp.net page i.e i should be able to share the music to all user.

    more over you havent given how to create the database.

  • User profile image
    Clint

    @varadharaj:  I believe we've covered databases in a different area.

    From looking at this, it should play.

    With that said, I think I'm going to create a new version of this article since I tried to run it and couldn't get it to run very easily.

    - clint

  • User profile image
    kram

    I have  just begun to use  Microsoft Visual Web Developer 2005 Express Edition version 2.050 727-7600. For development I am usinng  the ASP.NET DEVELOPMENT SERVER that is installed with the developer.

    I have tried to run your code by downloading it from this site and opening in the IDE. I performed a build, resulting in 3 benign looking warnings, that should not really impede execution. Upon execution I received the following server error:

    Server Error in '/VisualBasic' Application.

    --------------------------------------------------------------------------------

    Specified cast is not valid.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.InvalidCastException: Specified cast is not valid.

    Source Error:

    Line 25: Private Shared Sub Refresh()

    Line 26: Dim wmp As WindowsMediaPlayer = New WindowsMediaPlayer

    Line 27: Dim playlist As IWMPPlaylist = wmp.mediaCollection.getAll()

    Line 28: Dim artistDictionary As Dictionary(Of String, Artist) = New Dictionary(Of String, Artist)

    Line 29:

    Can  you  comment?

    Can COM controls be conveniently  used in visual web developer.net express edition? Some users say no!!

    Thank You!!

  • User profile image
    Clint

    I'll work on reencoding this project in a VS Friendlier solution.  This is one of our projects from Coding4Fun version 1 so it could very well be much older than the date listed above.

  • User profile image
    College Fun Facts » Coding4Fun : Building a Web Site with ASP .NET 2.0 to Navigate Your …
  • User profile image
    Samardeep

    The simplest way to have a media player in your web applicaion is- Download Microsot Silverlight and ASP.net 3.5 extensions

  • User profile image
    kevin

    can you please upload the zip file so i can study, thank you.

  • User profile image
    Matt

    I'm sorry but it is very hard to follow your code and your explanation above does not help. THis is supposed to be coding for fun, not code that will frustrate the hell out of you. What is the WMPLib.dll? What is the starting point of the app? Where are you getting the artist that come up when you run the app? Why in your instructions you say to change a line of code that when you change it HAS NO AFFECT ON THE APP. Why when I click on the config for the ObjectDatasSource it gives me an error saying "The type Binder could not be loaded. If the type is located in the App_Code folder, please check that it compiles." What does that mean?

    I'm sorry but this is very frustrating. Try to explain your code better.

  • User profile image
    Matt

    How do you point it to your music file. I the directions it says to:

    Replace the following in the web.config with a mapping that's valid on your computer:

     <add key="Mappings" value="g:\music|\\mediacenter\music"/>

    But if I get rid of this line completely and leave it blank the app still gives me that default list of artists. What's going on?????????

  • User profile image
    Matt

    Have you fixed this yet so it works over the internet?

  • User profile image
    avaz

    Dummy question: Mr.Jeff Key,

    Your application is loading every single artist and it's all albums,  tracks on default.aspx into the memory.

    artist.albums.tracks

    Is not that too much to load? if I had 5,000 University students using my music server per minute?

    If it is how would you solve it?

    May be the design patterns you are practicing just off the shelf and not meant for large scale software?

    Sincerely,

    Avaz

  • User profile image
    Avaz

    i think it's a great article and does say level: intermediate!

    definetly was fun for me!

    If you don't get it, don't worry ...others do!

    Avaz

  • User profile image
    Clint

    @Avaz, You can cache the page.  I'd cache it for an hour or longer depending on how often the music collection changes or how often you want it to update.

    No matter what, if you have 5000 people accessing your computer, your hard drives may have a hard time keeping up.  Figure 5MB a song, song is 3 minutes long (so 1.66MB/min), that comes out to be 8.3 gigs worth of data transferred every minute.

    I don't think this was designed for the scenario you're describing.

  • User profile image
    Mosh Jahan

    For IIS you may need to configure the Windows Media Player Network Sharing service to run using LocalSystem account.  The IUSR account's media library might also be empty.  I wonder if there is a way to work directly with the WMP database?

  • User profile image
    ganesh todkar

    Husshh..!! Finally my search ends here..!!

    This article helped me a lot..!!

    Thanks for it.!!

  • User profile image
    Bill Roberts

    Sorry I've slammed so many comments but, have been hacking all weekend and i'm generally one to keep on even when i think i've hit a wall.

    so, comes down to... when IIS is involved , seems i have only access to crud like:

    C:\Users\Bill\AppData\Local\Microsoft\Media Player\Sync Playlists\*.*

    but when i use the built in VS server, seems things work as expected.

    I've gone so far are to run my AppPool using my id/pw along with configuring my site also to use my id/pw.

    Odd thing is that the PlayLists exposed don't even show up in the PlayLists tab for Window Media Player.

    Anyway, not sure where to go from here Sad

  • User profile image
    Bill Roberts

    Thanks for this info !

    I've compiled a project in VS2008 against 3.5 on a Windows 7 x64 rig and when run using the VISUAL STUDIO DEVELOPMENT SERVER, it runs without a hitch.

    But when I run in IIS 7 (same machine), I can load the Default.Aspx, but seems no code is actually kicked off... Ideas?

    kinda rusty here ... but, I believe I've have created an Web Application rather then a Web site...

    Thanks again for a wonderful thread Smiley

  • User profile image
    Clint

    @Bill Roberts RE: IIS7 issue, do you have IIS with dynamic content enabled?  for super easy configuration, I tend to use Web PI.  http://microsoft.com/web/ to get IIS setup quick.

Add Your 2 Cents