Thursday 26 June 2008

Loosing the Address Bar

Microsoft Windows has had the "address bar" for a long time. Although not used by many adding it to your taskbar for some has provided an amazing way of quickly getting to files, folders and web addresses.


I have used it for a while and have it in the bottom row of my task bar, I have this setup at home on my machine, work and until recently Hayleys Laptop.


SP3 came out recently and I immediately updated Hayleys laptop to it, all seemed fine, however today I logged into as me, and noticed the address bar had "vanished". First of all I thought I has just knocked it off but no it had physically disapeared from the toolbar list.


A quick Google later left me speachless....


"After installing Windows XP Service Pack 3, the Address Bar feature will be removed from the Taskbar. The Address Bar feature will not be present in Windows XP Service Pack 3. This change is in response to a regulatory request and is present beginning with Windows XP Service Pack 3 Beta."

It has been removed! The reason behind this is that the Addres Bar is actually part of IE, and Microsoft are trying to make IE less dominant within Windows due to antitrust. I personally think this is a joke, if the address bar opens links up in your preffered browser, in my case Firefox, does it matter that it's an IE component that fires up FireFox??


After further browsing I have found an Addon some one has wrote MuvEnum Address Bar to help with the issue but as of yet I havn't tried it due to now wanting to put something else on Hayleys Laptop.


To remove such an established feature is a real low blow, and I'm sure there must be a better solution, even if it involved more work.... So I was left without my address bar on Hayleys Laptop and hoping that work doesn't upgrade to SP3 anytime soon. Interestingly SP1 Vista still has the address bar so I wonder if SP2 will remove it.

Tuesday 24 June 2008

Using Yahoo! Media Player on a dynamic page

Recently I added paging to my churches podcast page, the steps on how I did this are part of another post that I aim to finish at some point, however I thought I'd quickly blog tonight some tips on using the Yahoo! Media Player on a dynamic page.


Originally the podcast paging was causing a full postback which reloaded everything on the page, this felt dirty so tonight I reconfigured my podcast control to make use of the ASP.Net Ajax UpdatePanel. The paging worked great however the WMP wasn't updating which left the playlist out of date and the new podcasts without play buttons.


The issue was that by default the YMP JS fires on load and the ajax update wouldn't trigger this. Moving the script to load as part of the ajax updated content also wouldn't help this, all I would be doing would be reloading the source, not actually solving the problem.


I turned to the YMP wiki however I didn't really turn anything up that was of great use.


I knew that the YMP scraped the page on load for MP3 files and then built up its playlist, so it was a case of finding this scrape function, clearing the current playlist and then triggering the scrape.


Firebug came to my rescue, I add a watch to the YMP object YAHOO.music.WebPlayer and found that it had quite a few functions available if you know they are there, I have listed a few useful ones below:

  • asyncLoadPlayer() - if the player is loaded after the window has loaded this will manually load the whole player
  • clear() - clears the playlist
  • pause() - pauses the item playing in the media player
  • play() - plays the current item in the playlist
  • scrape() - scrapes the page for mp3's and adds them to the playlist
  • shutdown() - shutsdown the media player and releases all resources
  • startup() - starts the player up, not sure if this is useful as asyncLoadPlayer()is probably better
  • stop() - stops the item playing in the media player


So for my case with a dynamically loading page I added some simple JavaScript to the content that is loaded in, this JavaScript first ensures YMP has already been loaded and then clears the playlist and scrapes the page for new media items for adding to the playlist.


function PageLoadedEventHandler() {
  if(YAHOO.music.WebPlayer.loaded){      
    YAHOO.music.WebPlayer.clear();      
    YAHOO.music.WebPlayer.scrape();
  }
}

I did ponder about leaving out the clear, that way as you page through the podcasts the playlist simply grows so you can listen to any of them, I decided against this but I hope you can see what you can do.


So there wasn't much to it, I am hoping Yahoo! will properly document the functions available within the YMP as I would have saved alot of time faffing with FireBug and the watch window. I hope this helps someone, I'm now thinking on how I could use my own player interface and utilise YMP to power it... any way thats something for a rainy day